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

Fix S2094 FP: Allow empty queries #9241

Closed
fraserkyle opened this issue May 2, 2024 · 3 comments · Fixed by #9392
Closed

Fix S2094 FP: Allow empty queries #9241

fraserkyle opened this issue May 2, 2024 · 3 comments · Fixed by #9392
Assignees
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Projects

Comments

@fraserkyle
Copy link

Description

It is not an uncommon pattern to have Querys with absolutely no members in it when using CQRS design pattern.
In such cases, rule S2094 raises.

Repro steps

Consider the following class, which is a totally valid Query.

public class GetAllUsersQuery {}

Expected behavior

I would expect rule S2094 not to raise on such classes.

I would suggest ignoring classes that have known Query suffix

@fraserkyle fraserkyle changed the title Fix Sxxxx FP/FN: Issue title Fix S2094 FP/FN: Allow empty queries May 2, 2024
@fraserkyle
Copy link
Author

Expands #9063

@mary-georgiou-sonarsource mary-georgiou-sonarsource changed the title Fix S2094 FP/FN: Allow empty queries Fix S2094 FP: Allow empty queries May 3, 2024
Tim-Pohlmann added a commit that referenced this issue May 3, 2024
@Tim-Pohlmann Tim-Pohlmann added Area: C# C# rules related issues. Type: False Positive Rule IS triggered when it shouldn't be. Area: VB.NET VB.NET rules related issues. labels May 3, 2024
@Tim-Pohlmann
Copy link
Contributor

Hi @fraserkyle, thanks for the report!
I confirm this as an FP.

@Tim-Pohlmann
Copy link
Contributor

This will require an RSPEC update.

Tim-Pohlmann added a commit that referenced this issue May 6, 2024
@sebastien-marichal sebastien-marichal self-assigned this Jun 4, 2024
@github-actions github-actions bot added this to Review in progress in Best Kanban Jun 4, 2024
@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Jun 4, 2024
Best Kanban automation moved this from Review approved to Validate Peach Jun 4, 2024
@sebastien-marichal sebastien-marichal moved this from Validate Peach to Done in Best Kanban Jun 5, 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. Area: VB.NET VB.NET rules related issues. Type: False Positive Rule IS triggered when it shouldn't be.
Projects
Best Kanban
  
Done
Development

Successfully merging a pull request may close this issue.

5 participants