From a08b1c2d68a0c9c86e786973eeeacc228d1d5956 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Wed, 24 Sep 2025 11:16:24 +0100 Subject: [PATCH 1/6] Update Program.cs --- Driver/Program.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Driver/Program.cs b/Driver/Program.cs index 14bc5cc1..877b98e0 100644 --- a/Driver/Program.cs +++ b/Driver/Program.cs @@ -40,6 +40,9 @@ internal static EventStoreClientSettings ConfigureEventStoreSettings() { return settings; } + public static void TestFunction(String param1,String param2,String param3,String param4,String param5,String param6,String param7,String param8,String param9,String param10,String param11){ + } + private static async Task Main(String[] args) { Logger.Initialise(NullLogger.Instance); await Program.SubscriptionsTest(); @@ -84,4 +87,4 @@ private static async Task SubscriptionsTest() { } #endregion -} \ No newline at end of file +} From 2150c57160be9ff2d2bde5252c18cf024d5cdae7 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 10:17:11 +0000 Subject: [PATCH 2/6] style: format code with dotnet-format This commit fixes the style issues introduced in a08b1c2 according to the output from dotnet-format. Details: https://github.com/TransactionProcessing/Shared/pull/867 --- Driver/Program.cs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/Driver/Program.cs b/Driver/Program.cs index 877b98e0..976b787d 100644 --- a/Driver/Program.cs +++ b/Driver/Program.cs @@ -20,10 +20,12 @@ internal class Program { #region Methods - internal static EventStoreClientSettings ConfigureEventStoreSettings() { + internal static EventStoreClientSettings ConfigureEventStoreSettings() + { EventStoreClientSettings settings = new(); - settings.CreateHttpMessageHandler = () => new SocketsHttpHandler { + settings.CreateHttpMessageHandler = () => new SocketsHttpHandler + { SslOptions = { RemoteCertificateValidationCallback = (sender, certificate, @@ -40,17 +42,20 @@ internal static EventStoreClientSettings ConfigureEventStoreSettings() { return settings; } - public static void TestFunction(String param1,String param2,String param3,String param4,String param5,String param6,String param7,String param8,String param9,String param10,String param11){ + public static void TestFunction(String param1, String param2, String param3, String param4, String param5, String param6, String param7, String param8, String param9, String param10, String param11) + { } - - private static async Task Main(String[] args) { + + private static async Task Main(String[] args) + { Logger.Initialise(NullLogger.Instance); await Program.SubscriptionsTest(); Console.ReadKey(); } - private static async Task QueryTest(){ + private static async Task QueryTest() + { String query = "fromStream('$et-EstateCreatedEvent')\r\n .when({\r\n $init: function (s, e)\r\n {\r\n return {\r\n estates:[]\r\n };\r\n },\r\n \"EstateCreatedEvent\": function(s,e){\r\n s.estates.push(e.data.estateName);\r\n }\r\n });"; EventStoreClient client = new(Program.ConfigureEventStoreSettings()); EventStoreProjectionManagementClient projection = new(Program.ConfigureEventStoreSettings()); @@ -60,12 +65,13 @@ private static async Task QueryTest(){ Console.WriteLine(result); } - private static async Task SubscriptionsTest() { + private static async Task SubscriptionsTest() + { String eventStoreConnectionString = "esdb://127.0.0.1:2113?tls=false"; Int32 inflightMessages = 50; Int32 persistentSubscriptionPollingInSeconds = 10; Int32 cacheDuration = 0; - + ISubscriptionRepository subscriptionRepository = SubscriptionRepository.Create(eventStoreConnectionString, cacheDuration); // init our SubscriptionRepository From a0da4e32cc7794826f6c9c8f28fb2155bb04c079 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Wed, 24 Sep 2025 14:25:15 +0100 Subject: [PATCH 3/6] Create codacypr --- .github/workflows/codacypr | 72 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/codacypr diff --git a/.github/workflows/codacypr b/.github/workflows/codacypr new file mode 100644 index 00000000..80e3a67c --- /dev/null +++ b/.github/workflows/codacypr @@ -0,0 +1,72 @@ +name: Sync Codacy Issues to GitHub + +on: + check_run: + types: [completed] + +jobs: + sync-issues: + if: github.event.check_run.name == 'Codacy Static Code Analysis' && + github.event.check_run.pull_requests != null && + github.event.check_run.pull_requests != '' + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set PR number + run: echo "PR_NUMBER=${{ github.event.check_run.pull_requests[0].number }}" >> $GITHUB_ENV + + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y jq + + - name: Fetch Codacy issues + env: + CODACY_TOKEN: ${{ secrets.CODACY_API_TOKEN }} + PROJECT_UUID: ${{ secrets.CODACY_PROJECT_UUID }} + PR_NUMBER: ${{ env.PR_NUMBER }} + run: | + curl -s -H "api-token: $CODACY_TOKEN" \ + "https://api.codacy.com/api/v3/analysis/organizations/gh/${{ github.repository_owner }}/repositories/${{ github.repository }}?pullRequest=$PR_NUMBER" \ + -o codacy_issues.json + echo "Found $(jq '.data.issues | length' codacy_issues.json) issues" + + - name: Authenticate GitHub CLI + uses: cli/cli-action@v2 + + - name: Sync Codacy issues to GitHub + env: + REPO: ${{ github.repository }} + run: | + cat codacy_issues.json | jq -c '.data.issues[]' | while read issue; do + ISSUE_ID=$(echo "$issue" | jq -r '.id') + TITLE=$(echo "$issue" | jq -r '.message' | cut -c1-250) + FILE=$(echo "$issue" | jq -r '.file') + LINE=$(echo "$issue" | jq -r '.line') + ISSUE_BODY="File: $FILE\nLine: $LINE\nCodacy ID: $ISSUE_ID" + + # Check if GitHub issue exists + EXISTING=$(gh issue list --repo $REPO --search "Codacy ID: $ISSUE_ID" --json number --jq '.[].number') + if [ -z "$EXISTING" ]; then + echo "Creating issue: $TITLE" + gh issue create --repo $REPO --title "[Codacy] $TITLE" --body "$ISSUE_BODY" + else + echo "Updating existing issue #$EXISTING: $TITLE" + gh issue edit $EXISTING --repo $REPO --body "$ISSUE_BODY" + fi + done + + - name: Close resolved GitHub issues + env: + REPO: ${{ github.repository }} + run: | + gh issue list --repo $REPO --state open --json number,body | jq -c '.[]' | while read gh_issue; do + ISSUE_NUMBER=$(echo "$gh_issue" | jq -r '.number') + ISSUE_BODY=$(echo "$gh_issue" | jq -r '.body') + CODACY_ID=$(echo "$ISSUE_BODY" | grep -oP 'Codacy ID: \K[0-9]+') + if ! jq -e --arg id "$CODACY_ID" '.data.issues[] | select(.id|tostring==$id)' codacy_issues.json > /dev/null; then + echo "Closing resolved GitHub issue #$ISSUE_NUMBER" + gh issue close $ISSUE_NUMBER --repo $REPO + fi + done From a580b66f04b9f366f755731b85b6b14a500441d1 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Wed, 24 Sep 2025 14:29:43 +0100 Subject: [PATCH 4/6] Rename codacypr to codacypr.yml --- .github/workflows/{codacypr => codacypr.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{codacypr => codacypr.yml} (100%) diff --git a/.github/workflows/codacypr b/.github/workflows/codacypr.yml similarity index 100% rename from .github/workflows/codacypr rename to .github/workflows/codacypr.yml From 99734b9b1492329021bec2ded89c11ed5af1bb14 Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Wed, 24 Sep 2025 19:09:16 +0100 Subject: [PATCH 5/6] Update Program.cs --- Driver/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Driver/Program.cs b/Driver/Program.cs index 976b787d..6aa54b91 100644 --- a/Driver/Program.cs +++ b/Driver/Program.cs @@ -42,8 +42,10 @@ internal static EventStoreClientSettings ConfigureEventStoreSettings() return settings; } - public static void TestFunction(String param1, String param2, String param3, String param4, String param5, String param6, String param7, String param8, String param9, String param10, String param11) + public static void TestFunction(String param1, String param2, String param3, String param4, String param5, String param6, String param7) { + // This is a test function + throw new NotImplementedException(); } private static async Task Main(String[] args) From c613188140fe121c268ae058051d105467f18e1c Mon Sep 17 00:00:00 2001 From: StuartFerguson Date: Wed, 24 Sep 2025 19:26:44 +0100 Subject: [PATCH 6/6] Update Program.cs --- Driver/Program.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Driver/Program.cs b/Driver/Program.cs index 6aa54b91..8deef45e 100644 --- a/Driver/Program.cs +++ b/Driver/Program.cs @@ -44,8 +44,7 @@ internal static EventStoreClientSettings ConfigureEventStoreSettings() public static void TestFunction(String param1, String param2, String param3, String param4, String param5, String param6, String param7) { - // This is a test function - throw new NotImplementedException(); + } private static async Task Main(String[] args)