-
Notifications
You must be signed in to change notification settings - Fork 1
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
ECS0600 False positives #73
Comments
Thanks for your issue report. I've corrected the documentation issue |
As for the false positive: I disagree that this is a false positive. The naming convention of the two cases are different, the first adding the "Name" suffix to the variable, while the second is the name of the member. Changing the first to be From "Item 6: Avoid String-ly Typed APIs"
I interpret the intent of Item 6 in this case that the There are other issues also: Item 2: Prefer readonly over const via #26 From "Item 2: Prefer readonly to const"
While it is unlikely that the type will change, it can and there's little practical benefit of it being a |
…CS0600 (#236) Effective C# rules 0200 and 0600 have violations in `src/Common/WellKnownTypeNames.cs`. This change updates the members in `WellKnownTypes` type and their usages Related to rjmurillo/EffectiveCSharp.Analyzers#73, see item for discussion - Updated constant declarations to static read-only fields for improved flexibility as referenced in [ECS0200](https://github.com/rjmurillo/EffectiveCSharp.Analyzers/blob/main/docs/rules/ECS0200.md) and removed suppression. - Updated naming conventions for `WellKnownTypes` to avoid triggering [ECS0600](https://github.com/rjmurillo/EffectiveCSharp.Analyzers/blob/main/docs/rules/ECS0600.md) - Updated control flow in `src/Analyzers/ConstructorArgumentsShouldMatchAnalyzer.cs` to move from switch, which requires compile time constants, to a more traditional if/else - Updated names in the former `WellKnownTypeNames` type (now `WellKnownMoqNames`) with improved names and added documentation
ECS0600 triggers in this situation:
I think it should not. It appears to be triggering because field name and value are the same. However, the
MockBehavior = nameof(MockBehavior)
should not be promoted as a best practice, because changing the name of the variable would silently also change the value, which may not be clear when refactoring.Note that in the docs the heading for this rule is also "ECS0006", which doesn't match the file name.
The text was updated successfully, but these errors were encountered: