-
Notifications
You must be signed in to change notification settings - Fork 239
New Rule S2629: Logging templates should be constant #8786
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
Conversation
b2382c6 to
2f28dc7
Compare
My understanding is that the attribute is declared on the type of the argument that is passed to the logging method invocation. It's not about the logging method. https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/interpolated-string-handler |
costin-zaharia-sonarsource
left a comment
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.
Looks good to me so far. I've added a couple of questions and I'm waiting for the RSPEC update.
analyzers/tests/SonarAnalyzer.Test/Rules/UseConstantLoggingTemplateTest.cs
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Rules/UseConstantLoggingTemplateTest.cs
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Rules/UseConstantLoggingTemplate.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Rules/UseConstantLoggingTemplate.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Rules/UseConstantLoggingTemplate.cs
Outdated
Show resolved
Hide resolved
fcf5bde to
b3c99b1
Compare
costin-zaharia-sonarsource
left a comment
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.
LGTM! Just a small change needed before I approve
analyzers/src/SonarAnalyzer.CSharp/Rules/UseConstantLoggingTemplate.cs
Outdated
Show resolved
Hide resolved
b3c99b1 to
4b64641
Compare
|
|



Fixes #8768
Deviations from the original RSPEC:
string.Format()is also checked