GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Fix lgtm issues by iSazonov · Pull Request #8843 · PowerShell/PowerShell Conversation
|
|
It seems like this PR is making the Code factor grade decline. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Reece Dunham (@RDIL) No, the issues already was there. CodeFactor has strange reports sometimes. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ah okay. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Web cmdlet changes LGTM
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Approved with non-blocking suggestions
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| else | ||
| { | ||
| if (nameMatcher.IsMatch(drive.Name)) | ||
| if (nameMatcher != null && nameMatcher.IsMatch(drive.Name)) |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can this be
| if (nameMatcher != null && nameMatcher.IsMatch(drive.Name)) | |
| if (nameMatcher?.IsMatch(drive.Name) ?? false) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Report is "Cannot implicitly convert type bool? to bool."
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe this works?
if (nameMatcher?.IsMatch(drive.Name) ?? false) { }
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks as puzzle :-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| if (targetDir.StartsWith(NonInterpretedPathPrefix, StringComparison.OrdinalIgnoreCase)) | ||
| if (targetDir != null && targetDir.StartsWith(NonInterpretedPathPrefix, StringComparison.OrdinalIgnoreCase)) |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can this be
| if (targetDir != null && targetDir.StartsWith(NonInterpretedPathPrefix, StringComparison.OrdinalIgnoreCase)) | |
| if (targetDir?.StartsWith(NonInterpretedPathPrefix, StringComparison.OrdinalIgnoreCase) ?? false) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The same.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
same as above
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Love the cleanup! 👍 😍
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| SetRequestContent(request, form.Fields); | ||
| } | ||
| else if (content is IDictionary && request.Method != HttpMethod.Get) | ||
| else if (content is IDictionary dictionary && request.Method != HttpMethod.Get) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of if/else if going on here. Can this be refactored into a pattern-matched switch instead?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Purpose of this PR is to fix null checks. So code refactoring is out of the PR. Feel free to push new PR if you see benefits.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { | ||
| cellCount = _lo.DisplayCells.Length(fpf.propertyValue); | ||
| if (widths[kk] < cellCount) | ||
| widths[kk] = cellCount; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
From what I've seen of the codebase, it seems like the inline / two-line if statement is generally avoided in favor of the explicitly-braced form, even for simple if statements. Should this follow the existing patterns?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The same.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| { | ||
| cellCount = _lo.DisplayCells.Length(fpf.propertyValue); | ||
| if (cellCount > maxLen) | ||
| maxLen = cellCount; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The same.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Rain Sallow (/u/ta11ow) (@vexx32) I consider such patterns as a "security" risk.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate Ilya (@iSazonov)?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Add some null checks Remove unused code
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.