dotnet / roslyn-analyzers

MIT License
1.58k stars 463 forks source link

CA1720 IdentifiersShouldNotContainTypeNames only checks the full identifier #6225

Open mickyman007 opened 1 year ago

mickyman007 commented 1 year ago

https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1720

The name of a parameter in a member contains a data type name.

-or-

The name of a member contains a language-specific data type name.

https://github.com/dotnet/roslyn-analyzers/blob/19f02959e8a039ed4e27cce1feff462b37bf0df6/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldNotContainTypeNames.cs#L129

Should check that any of the type names in s_typeNames is contained within identifier

Not sure if this a grammatical issue with the rule documentation or if the code needs changed to reflect the grammatical syntax, since if we were to start cheking the identifer containing type names then identifiers such as IntegratedXXX will be false flagged.

mickyman007 commented 1 year ago

This was noticed when the old FxCop rule CA1720 flagged displayModeInt but this new analyser rule doesn't flag it