-
Notifications
You must be signed in to change notification settings - Fork 183
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
feat(analyzer): add rules regarding model name suffixes #6916
feat(analyzer): add rules regarding model name suffixes #6916
Conversation
- add four rules checking the suffixes of model names - upgrade Roslyn to latest version since new rules require some API - minor refactor existing codes - add test cases for the new rules resolve Azure#6905
eafaee9
to
94bfbb0
Compare
94bfbb0
to
2e313f4
Compare
preview pr on @m-nash ^^ |
{ | ||
protected static readonly string Title = "Improper model name suffix"; | ||
protected static readonly string Description = "Suffix is not recommended. Consider to remove or modify it."; | ||
protected static readonly string GeneralRenamingMessageFormat = "Model name '{0}' ends with '{1}'. Suggest to rename it to an appropriate name."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this link to our guidelines that specify the naming rules we are enforcing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find the official guidelines. We do have a OneNote page on that. @m-nash Shall we update the .NET Azure SDK Design Guidelines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we can do something like StyleCop.
- For each diagnostic ID, we create a page, like https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md
- In each page, we provide explanation of the diagnostic, and provide mitigation solution.
...otnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/ModelName/GeneralSuffixAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/ModelName/SuffixAnalyzerBase.cs
Outdated
Show resolved
Hide resolved
src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/ModelName/SuffixAnalyzerBase.cs
Outdated
Show resolved
Hide resolved
src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers.Tests/ModelName/AZC0030Tests.cs
Outdated
Show resolved
Hide resolved
src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/AnalyzerUtils.cs
Outdated
Show resolved
Hide resolved
src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/ModelName/SuffixAnalyzerBase.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Christopher Scott <[email protected]>
@christothes @m-nash Changes after last review:
Updated preview PR on
|
src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/AnalyzerUtils.cs
Outdated
Show resolved
Hide resolved
src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/INameSpaceSymbolExtensions.cs
Outdated
Show resolved
Hide resolved
# Conflicts: # src/dotnet/Azure.ClientSdk.Analyzers/Azure.ClientSdk.Analyzers/Descriptors.cs
Changes since last review:
Preview PR: Azure/azure-sdk-for-net#39518 It's the same as the previous one, except that analyzer package is the latest. |
resolve #6905