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 S2178 Rule message: Mention extracting right operand if applicable #8559

Closed
Tim-Pohlmann opened this issue Jan 17, 2024 · 0 comments · Fixed by #8598
Closed

Fix S2178 Rule message: Mention extracting right operand if applicable #8559

Tim-Pohlmann opened this issue Jan 17, 2024 · 0 comments · Fixed by #8598
Assignees
Labels
Area: C# C# rules related issues. Area: VB.NET VB.NET rules related issues. Sprint: Hardening Fix FPs/FNs/improvements
Milestone

Comments

@Tim-Pohlmann
Copy link
Contributor

Tim-Pohlmann commented Jan 17, 2024

S2178's message as defined in RSPEC:
Correct this "x" to "xx" [and extract the right operand to a variable if it should always be evaluated].
Our analyzer does not implement the optional part. This can lead developers into a trap, changing the behavior of their code without noticing.
Our analyzer should detect if the right operand is constant or a pure method, and if it is not, use the extended message.

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. Sprint: Hardening Fix FPs/FNs/improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants