Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
New rule S3063: "StringBuilder" data should be used #6696
New rule S3063: "StringBuilder" data should be used #6696
Changes from 30 commits
c99b62c
08f0ba3
b7d0d30
e487913
7ddcd31
1dee716
b4c1029
97a2421
d2554e6
740a16e
85e22ee
e6ce8bd
59f1967
f0003ba
c062371
f44dc07
c207c32
226bfdf
73ca43b
344e472
0830d34
77a23a1
7da66e4
7c96800
a26ea27
df5dc9c
ba38024
76383c1
2ac2907
716a82d
408e5fa
5ba0b53
232c216
add749b
424f743
95e9522
a6b6c98
498e6f0
0d2733e
aaa0754
d60927c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Can you increase the code coverage 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.
Can you try to remove this method?
For the declaration, we already have the
ILocalSymbol.Name
and for the other cases, addGetIdentifier
orGetName
to the language facade if it isn't there already (there are extensions methods for VB and CS already so it should be just a delegation to the existing implementation). I would prefer the use of GetIdentifier (returns Token) over GetName (returns string).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.
static?
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.
See comment above
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 be private or protected.
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.
This may raise on the
Names[0]
access (for invalid code). You better safeguard against this. We also run in the IDE and there we often get called with broken code and we, therefore, do defensive coding.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.
Do some type-checks for the expected parents to increase readability and robustness.
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.
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.
Contains
needs to use the VB string comparer (case insensitive) also. You may be better of by moving theStringBuilderAccessInvocations.Contains
as a helper to the base class and makeStringBuilderAccessInvocations
private to prevent such mistakes.Please add a test for different casing as well.
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.
Same as for
StringBuilderAccessInvocations.Contains
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.