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
base: feature/New_S6932
Are you sure you want to change the base?
Add Argument tracker and tests #8950
Conversation
Quality Gate passedIssues Measures |
Quality Gate failedFailed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
094e1ee
to
b892fbb
Compare
Quality Gate passedIssues Measures |
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.CSharp/Trackers/CSharpArgumentTracker.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
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.
My last round on the ArgumentTrackerTest.cs
. I will continue with impl review.
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
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.
Another round, this time for ArgumentDescriptor
. I'm sorry for the slow progress but it takes me longer than expected to review the code.
analyzers/src/SonarAnalyzer.CSharp/Trackers/CSharpArgumentTracker.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Trackers/CSharpArgumentTracker.cs
Outdated
Show resolved
Hide resolved
analyzers/src/SonarAnalyzer.CSharp/Trackers/CSharpArgumentTracker.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.Common/Helpers/ArgumentDescriptor.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.cs
Outdated
Show resolved
Hide resolved
analyzers/tests/SonarAnalyzer.Test/Trackers/ArgumentTrackerTest.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
Quality Gate passed for 'Sonar .NET Java Plugin'Issues Measures |
Quality Gate failed for 'SonarAnalyzer for .NET'Failed conditions See analysis details on SonarCloud Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
Adds an ArgumentDescriptor and logic to match an ArgumentSyntax against it.
Based on #8947