Cleanup CodeFactor issues with empty strings#6950
Cleanup CodeFactor issues with empty strings#6950daxian-dbw merged 18 commits intoPowerShell:masterfrom
Conversation
markekraus
left a comment
There was a problem hiding this comment.
LGTM assuming tests pass
|
@markekraus Many thanks for fast review! |
dca7c3f to
84ea832
Compare
|
I don't see the point. Why not just disable the warning and skip the code churn? |
|
It is readability issue. If we use advanced editor with code highlighting we haven't problems to see "". If we use a simple editor the string.Empty visibility is much better. |
|
I find |
BrucePay
left a comment
There was a problem hiding this comment.
Overall the results look good. All the changes seem fine.
There was a problem hiding this comment.
Could migrate all of the ", " strings into a constant.
There was a problem hiding this comment.
Constant or static?
There was a problem hiding this comment.
Is there any reason it shouldn't be constant?
There was a problem hiding this comment.
We already have a lot of static variables for such strings.
I found 4487 hits in 581 file for ", ". So static may be useful.
There was a problem hiding this comment.
As long as we don't need to change the string, I prefer constant. But that should be in a separate PR.
There was a problem hiding this comment.
If this is an autogen'ed file should you be changing it or the generator?
There was a problem hiding this comment.
The files is not regenerated and already was changed manually. Seems we should rename the files and remove "autogen" from file names.
There was a problem hiding this comment.
And remove the comments saying "this is an autogen'ed file, don't edit"
|
@SteveL-MSFT Can we merge? |
|
@iSazonov What does indicate as the reasoning for this change? Is this a readability or programmatic warning? My understanding of "" is that it is interned and you will have one instance per assembly. In all other regards, String.Empty is synonymous with "". |
There was a problem hiding this comment.
Good catch!
Fixed.
There was a problem hiding this comment.
missing replacing an instance of ""
|
@dantraMSFT I think the purpose is to enable the style checking about empty string (favor @iSazonov Thanks for spending efforts on driving the style consistency. I ran I quickly go through the changes and didn't notice any replacements in PowerShell scripts in |
|
@dantraMSFT The PR has a purpose to turn CodeFactor into a more useful tool. Currently we see over 100000 issues most of which are style issues. |
18ed825 to
3ef9ef0
Compare
3ef9ef0 to
dec9f0c
Compare
|
@daxian-dbw I re-check - no scripts was changed. Rebased to remove PSReadline. |
PR Summary
Please fast review to avoid merge conflicts because of many files changed.
Please review commit by commit - every commit contains only single kind of change so you can do very fast review.
This corrects about 1% of the CodeFactor issues.
The PR replace "" with string.Empty.
All changes is made in VS Code with Regex patterns - one pattern by commit:
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests