-
Notifications
You must be signed in to change notification settings - Fork 228
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
New rule S6968 for C#: Actions that return a value should be annotated with ProducesResponseTypeAttribute containing the return type #9185
Conversation
f32e0d1
to
f12d0ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good work, but we need to consider some more cases.
Mostly this is on me, as I did not add "negative" tests that should be compliant during spec😞
To sum it up:
- Invocations should be inside return statements
- Some
ControllerBase
overloads need to be excluded SwaggerResponse
at controller level.
analyzers/tests/SonarAnalyzer.Test/Rules/SwaggerActionReturnTypeTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Rules/SwaggerActionReturnTypeTest.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Rules/SwaggerActionReturnType.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Rules/SwaggerActionReturnType.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Rules/SwaggerActionReturnType.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Rules/SwaggerActionReturnType.cs
Outdated
Show resolved
Hide resolved
4734c75
to
64042ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Pull Request is not mergeable
64042ab
to
d7672ff
Compare
Quality Gate passedIssues Measures |
Quality Gate passedIssues Measures |
Fixes #9093