-
Notifications
You must be signed in to change notification settings - Fork 223
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
Add Argument tracker and tests #8950
Add Argument tracker and tests #8950
Conversation
|
|
094e1ee
to
b892fbb
Compare
|
analyzers/src/SonarAnalyzer.CSharp/Helpers/CSharpAttributeParameterLookup.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Helpers/CSharpMethodParameterLookup.cs
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Helpers/ArgumentDescriptor.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Helpers/ArgumentDescriptor.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Helpers/ArgumentDescriptor.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Helpers/ArgumentDescriptor.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Helpers/ArgumentDescriptor.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.VisualBasic/Extensions/SyntaxNodeExtensions.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Helpers/MethodParameterLookupBase.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Helpers/MethodParameterLookupBase.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.Common/Helpers/MethodParameterLookupBase.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.VisualBasic/Helpers/VisualBasicAttributeParameterLookup.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Trackers/CSharpArgumentTracker.cs
Outdated
Show resolved
Hide resolved
&& Language.MethodParameterLookup(invoked, methodSymbol).TryGetSymbol(argumentNode, out var parameter) | ||
&& ParameterFits(parameter, descriptor.ParameterConstraint, descriptor.InvokedMemberConstraint)) | ||
{ | ||
context.Parameter = parameter; |
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 find it very confusing that this method has side effects. Will this used only in tests?
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.
Will this used only in tests?
Unfortunately not. The rule PR uses this call.
this method has side effects
Yes. This is very unfortunate. There should be a distinction between input and output, but the context is both at the moment. This is how the tracker is designed now: It creates a pipeline of matchers and passes the context from one to the others. Each matcher can manipulate parts of the context. (It's a bit like the request pipeline in asp.net core).
analyzers/src/SonarAnalyzer.VisualBasic/Trackers/VisualBasicArgumentTracker.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.VisualBasic/Trackers/VisualBasicArgumentTracker.cs
Show resolved
Hide resolved
70f5741
to
f798a43
Compare
5631cb6
to
b5becf0
Compare
f798a43
to
f71058e
Compare
b5becf0
to
529ed91
Compare
a907dbd
to
e0d6cf2
Compare
|
|
c117342
into
feature/New_S6932
Co-authored-by: Gregory Paidis <gregory.paidis@sonarsource.com>
Adds an ArgumentDescriptor and logic to match an ArgumentSyntax against it.
Based on #8947