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 S109 message #7213

Closed
pavel-mikula-sonarsource opened this issue May 16, 2023 · 0 comments · Fixed by #7668
Closed

Improve S109 message #7213

pavel-mikula-sonarsource opened this issue May 16, 2023 · 0 comments · Fixed by #7668
Assignees
Labels
Area: C# C# rules related issues.
Milestone

Comments

@pavel-mikula-sonarsource
Copy link
Contributor

The current message is this

Assign this magic number '2' to a well-named (variable|constant), and use the (variable|constant) instead.

That's literal copy/paste from rspec
https://github.com/SonarSource/rspec/blob/master/rules/S109/message.adoc

but this rspec notation was supposed to be implemented as one of those two variants. Users should not see it.
It should have been

Assign this magic number '2' to a well-named constant, and use the constant instead.

or

Assign this magic number '2' to a well-named variable, and use the variable instead.

or we can go around like this

Assign this magic number '2' to a well-named variable or constant, and use that instead.
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants