Skip to content
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

Improve S6964: Report on Controller Action parameters when Model type is in a different project #9243

Open
zsolt-kolbay-sonarsource opened this issue May 2, 2024 · 0 comments
Labels
Area: C# C# rules related issues. Sprint: Hardening Fix FPs/FNs/improvements Type: False Negative Rule is NOT triggered when it should be.
Projects
Milestone

Comments

@zsolt-kolbay-sonarsource
Copy link
Contributor

zsolt-kolbay-sonarsource commented May 2, 2024

Improve #9094
S6964 currently only raises an issue when the (neither nullable nor [Required]) property is declared in the same assembly as the Controller (see this test case). This is due to Roslyn not being able to raise an issue if the location is in a different project than the one being analyzed.
Improve the rule by raising an issue even if the property is declared in a different project. In that case, the issue location should be Controller Action parameter. In the previous example it should raise an issue pointing to the person parameter with the message This model parameter can be under-posted due to the Person.Age property not being nullable or being decorated with the [Required] attribute.

@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource added Type: Improvement Making existing code better. Area: C# C# rules related issues. Type: False Negative Rule is NOT triggered when it should be. and removed Type: Improvement Making existing code better. labels May 2, 2024
@mary-georgiou-sonarsource mary-georgiou-sonarsource added the Sprint: Hardening Fix FPs/FNs/improvements label May 21, 2024
@mary-georgiou-sonarsource mary-georgiou-sonarsource added this to the 9.26 milestone May 21, 2024
@mary-georgiou-sonarsource mary-georgiou-sonarsource moved this from To do to In progress in Best Kanban May 23, 2024
@mary-georgiou-sonarsource mary-georgiou-sonarsource moved this from In progress to To do in Best Kanban May 23, 2024
@mary-georgiou-sonarsource mary-georgiou-sonarsource removed their assignment May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Sprint: Hardening Fix FPs/FNs/improvements Type: False Negative Rule is NOT triggered when it should be.
Projects
Best Kanban
  
To do
Development

No branches or pull requests

2 participants