From 09c3e4c80b8ecc0aaa67067fef06e8ef315a1a98 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Thu, 21 Nov 2024 19:15:55 +0100 Subject: [PATCH 1/2] Refactor connection traversal to use visitedConnections set Replaced visitedActivities with visitedConnections to ensure accuracy and clarity in tracking visited connections rather than activities. This change fixes #5865 --- .../Extensions/ConnectionsExtensions.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/ConnectionsExtensions.cs b/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/ConnectionsExtensions.cs index 1c0ffb17b..cd653a2ba 100644 --- a/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/ConnectionsExtensions.cs +++ b/src/modules/Elsa.Workflows.Core/Activities/Flowchart/Extensions/ConnectionsExtensions.cs @@ -12,10 +12,10 @@ public static class ConnectionsExtensions /// public static IEnumerable Descendants(this ICollection connections, IActivity parent) { - var visitedActivities = new HashSet(); - return connections.Descendants(parent, visitedActivities); + var visitedConnections = new HashSet(); + return connections.Descendants(parent, visitedConnections); } - + /// /// Returns all ancestor connections of the specified parent activity. /// @@ -41,7 +41,7 @@ public static class ConnectionsExtensions return filteredConnections; } - + /// /// Returns all "left" ancestor connections of the specified activity. "Left" means "not a descendant of the activity". /// @@ -58,27 +58,27 @@ public static class ConnectionsExtensions /// Returns all inbound activities of the specified activity. /// public static IEnumerable InboundActivities(this ICollection connections, IActivity activity) => connections.InboundConnections(activity).Select(x => x.Source.Activity); - + /// /// Returns all "left" inbound activities of the specified activity. "Left" means "not a descendant of the activity". /// public static IEnumerable LeftInboundActivities(this ICollection connections, IActivity activity) => connections.LeftInboundConnections(activity).Select(x => x.Source.Activity); - + /// /// Returns all "left" ancestor activities of the specified activity. "Left" means "not a descendant of the activity". /// public static IEnumerable LeftAncestorActivities(this ICollection connections, IActivity activity) => connections.LeftAncestorConnections(activity).Select(x => x.Source.Activity); - private static IEnumerable Descendants(this ICollection connections, IActivity parent, ISet visitedActivities) + private static IEnumerable Descendants(this ICollection connections, IActivity parent, ISet visitedConnections) { - var children = connections.Where(x => parent == x.Source.Activity && !visitedActivities.Contains(x.Target.Activity)).ToList(); + var children = connections.Where(x => parent == x.Source.Activity && !visitedConnections.Contains(x)).ToList(); foreach (var child in children) { - visitedActivities.Add(child.Target.Activity); + visitedConnections.Add(child); yield return child; - var descendants = connections.Descendants(child.Target.Activity, visitedActivities).ToList(); + var descendants = connections.Descendants(child.Target.Activity, visitedConnections).ToList(); foreach (var descendant in descendants) { @@ -86,7 +86,7 @@ public static class ConnectionsExtensions } } } - + private static IEnumerable Ancestors(this ICollection connections, IActivity activity, ISet visitedActivities) { var parents = connections.Where(x => activity == x.Target.Activity && !visitedActivities.Contains(x.Source.Activity)).ToList(); From bb8b0551f40501b29dbcd73b1b8b6ccc60d00d2f Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Thu, 21 Nov 2024 19:17:35 +0100 Subject: [PATCH 2/2] Disable SonarCloud analysis steps in workflow Commented out steps related to SonarCloud analysis to temporarily disable them. This includes setting up JDK, installing necessary tools, and running SonarCloud commands for code analysis and coverage. --- .github/workflows/packages.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 387bf9560..3a77d06f0 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -54,25 +54,25 @@ jobs: else echo "VERSION=${{env.base_version}}-${PACKAGE_PREFIX}.${{github.run_number}}" >> $GITHUB_ENV fi - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - java-version: '17' - distribution: 'adopt' - - name: Install SonarScanner for .NET - run: dotnet tool install --global dotnet-sonarscanner - - name: Install Coverlet for code coverage - run: dotnet tool install --global coverlet.console - - name: Begin SonarCloud analysis - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: dotnet sonarscanner begin /k:"elsa-workflows_elsa-core" /o:"elsa-workflows" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.exclusions=**/obj/**,**/*.dll,build/**,samples/**,src/apps/** /d:"sonar.verbose=true" /d:sonar.cs.opencover.reportsPaths=**/testresults/**/coverage.opencover.xml +# - name: Set up JDK 17 +# uses: actions/setup-java@v2 +# with: +# java-version: '17' +# distribution: 'adopt' +# - name: Install SonarScanner for .NET +# run: dotnet tool install --global dotnet-sonarscanner +# - name: Install Coverlet for code coverage +# run: dotnet tool install --global coverlet.console +# - name: Begin SonarCloud analysis +# env: +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# run: dotnet sonarscanner begin /k:"elsa-workflows_elsa-core" /o:"elsa-workflows" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.exclusions=**/obj/**,**/*.dll,build/**,samples/**,src/apps/** /d:"sonar.verbose=true" /d:sonar.cs.opencover.reportsPaths=**/testresults/**/coverage.opencover.xml - name: Compile+Test+Pack run: ./build.sh Compile+Test+Pack --version ${VERSION} --analyseCode true - - name: End SonarCloud analysis - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" +# - name: End SonarCloud analysis +# env: +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" - name: Upload artifact uses: actions/upload-artifact@v4 with: