| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM assuming tests pass
Sorry, something went wrong.
|
Mark Kraus (@markekraus) Many thanks for fast review! |
Sorry, something went wrong.
|
I don't see the point. Why not just disable the warning and skip the code churn? |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
I find "" to be more readable, it's shorter and the syntax is very familiar - we don't give all string literals a name for readability. |
Sorry, something went wrong.
There was a problem hiding this comment.
Overall the results look good. All the changes seem fine.
Sorry, something went wrong.
There was a problem hiding this comment.
Could migrate all of the ", " strings into a constant.
Sorry, something went wrong.
There was a problem hiding this comment.
Constant or static?
Sorry, something went wrong.
There was a problem hiding this comment.
Is there any reason it shouldn't be constant?
Sorry, something went wrong.
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.
Sorry, something went wrong.
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.
Sorry, something went wrong.
There was a problem hiding this comment.
If this is an autogen'ed file should you be changing it or the generator?
Sorry, something went wrong.
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.
Sorry, something went wrong.
There was a problem hiding this comment.
And remove the comments saying "this is an autogen'ed file, don't edit"
Sorry, something went wrong.
There was a problem hiding this comment.
Tracking issue #6974
Sorry, something went wrong.
|
Steve Lee (@SteveL-MSFT) Can we merge? |
Sorry, something went wrong.
|
Ilya (@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 "". |
Sorry, something went wrong.
There was a problem hiding this comment.
This should be reverted.
Sorry, something went wrong.
There was a problem hiding this comment.
Good catch!
Fixed.
Sorry, something went wrong.
There was a problem hiding this comment.
missing replacing an instance of ""
Sorry, something went wrong.
There was a problem hiding this comment.
Fixed.
Sorry, something went wrong.
There was a problem hiding this comment.
Here too.
Sorry, something went wrong.
There was a problem hiding this comment.
Fixed.
Sorry, something went wrong.
|
Dan Travison (@dantraMSFT) I think the purpose is to enable the style checking about empty string (favor string.Emtpy over ""). That rule cannot be turned on today due to too much noise. Ilya (@iSazonov) Thanks for spending efforts on driving the style consistency. I ran check-stringreplacementchange-ps1 with this PR and the results look good except for the three comments I left. $log = .\Check-StringReplacementChange.ps1 -PRUrl https://github.com/PowerShell/PowerShell/pull/6950 -OriginalText '@""','""' -NewText 'string.Empty' -PassThru I quickly go through the changes and didn't notice any replacements in PowerShell scripts in .cs files, that's good because string.Emtpy will definitely fail in powershell script. However, since I went through so quickly, I could miss something, so please double check that you are not replacing anything in powershell script (script strings). After double checking that, the PR should be good. |
Sorry, something went wrong.
|
Dan Travison (@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. |
Sorry, something went wrong.
|
Dongbo Wang (@daxian-dbw) I re-check - no scripts was changed. Rebased to remove PSReadline. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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:
'= "";' -> '= string.Empty;' 'return "";' -> 'return string.Empty;' ': "";' -> ': string.Empty;' '\?\? "";' -> '?? string.Empty;' '\(""\)' -> '(string.Empty)' ' ""\)' -> ' string.Empty)' '\("",' -> '(string.Empty,' ', "",' -> ', string.Empty,' ',""\)' -> ', string.Empty)' '\? "" :' -> '? string.Empty :' '\?\? ""' -> '?? string.Empty' ' = "",' -> ' = string.Empty,' ': "",' -> ': string.Empty,' '@""\)' -> 'string.Empty)'PR Checklist