-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Roslyn analyzer for workflows #1440
Open
ngruson
wants to merge
8
commits into
dapr:release-1.16
Choose a base branch
from
ngruson:1426-ng-analyzers
base: release-1.16
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Introduced a new diagnostic analyzer `WorkflowActivityAnalyzer` to check if workflow activities are registered in the DI container. Updated the solution to include new projects for analyzers and their tests. Added unit tests to verify analyzer functionality and updated documentation to reflect the new release and rules. Included necessary package references and streamlined testing setup. Signed-off-by: Nils Gruson <[email protected]>
Introduce `WorkflowRegistrationAnalyzer` and `WorkflowActivityAnalyzer` to validate workflow and activity registrations in the DI container. Implement corresponding code fix providers to suggest automatic fixes. Add tests to ensure functionality and robustness of the Dapr workflow framework. Signed-off-by: Nils Gruson <[email protected]>
Signed-off-by: Nils Gruson <[email protected]>
c2ac5e7
to
5e9abec
Compare
Added `<IncludeBuildOutput>false</IncludeBuildOutput>` to `Dapr.Workflow.Analyzers.csproj` to prevent the build output from being included as a library dependency. This change includes a comment for clarity and aligns with existing NuGet package properties. Signed-off-by: Nils Gruson <[email protected]>
Updated the WorkflowRegistrationCodeFixProvider to include logic for obtaining the semantic model and extracting workflow type names. Added methods for finding and creating the AddDaprWorkflow invocation. Modified the Utilities class to reference WebApplication. Expanded test coverage in WorkflowRegistrationCodeFixProviderTests with new cases for handling AddDaprWorkflow invocations, including standard and top-level statements. Signed-off-by: Nils Gruson <[email protected]>
Pointing to merge to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a Roslyn analyzer that checks if workflows and activities are registered properly.
For workflows, the analyzer checks if a workflow is referenced in
DaprWorkflowClient.ScheduleNewWorkflowAsync
calls (other logic may be added to determine if a workflow is referenced?).For workflow activities, the analyzer checks if activities are referenced in workflows in
WorkflowContext.CallActivityAsync
calls.For both scenarios, code fix providers have been added to add
RegisterWorkflow
orRegisterActivity
calls toAddDaprWorkflow
code.We have to come up with a general approach for Roslyn analyzers. Maybe we can move these remarks to the issue.
Dapr.Workflow.Analyzers
).Dapr.Workflow
).Other open questions:
Issue reference
This PR belongs to issue #1426.
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: