GeezerVison is showing github.com — Style: Add period in summary doc tags by iSazonov · Pull Request #8577 · PowerShell/PowerShell
Conversation
PR Summary
Style fix: Add period in summary doc tags.
PR Checklist
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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 ran a script to validate the changes in this PR, and all look good :D Thanks Ilya (@iSazonov)!
CheckAddingPeriod.ps1
param(
[Parameter(Mandatory=$true)]
[string]
$PRUrl,
[switch]
$PassThru
)
enum DiffState {
None
FileInfo
DiffContent
}
[DiffState]$state = [DiffState]::None
$Log = @{}
$diffFile = Join-Path -Path $PSScriptRoot -ChildPath "diff.txt"
if (Test-Path -Path $diffFile) { Remove-Item -Path $diffFile -Force -ErrorAction Stop }
##
## .diff and .patch can be append in the end to get some raw content
##
$PRUrl += ".diff"
Invoke-WebRequest -Uri $PRUrl -OutFile $diffFile
$Script:ScanResult = $null
switch -Wildcard -File $diffFile
{
"diff --git *"
{
$state = [DiffState]::FileInfo
$fileName = ($_ -split " ")[-1].Substring(2)
if ($Script:ScanResult -ne $null -and
$Script:ScanResult["OriginalStrs"].Count -ne $Script:ScanResult["NewStrs"].Count)
{
throw "$($Script:ScanResult['FileName']) contains mismatched + and -"
}
if ($Log.ContainsKey($fileName))
{
throw "$fileName appeared twice in diff file. Something is wrong"
}
$Script:ScanResult = @{ FileName = $fileName; OriginalStrs = @(); NewStrs = @() }
$Log[$fileName] = $Script:ScanResult
}
"@@ * @@ *"
{
$state = [DiffState]::DiffContent
}
"-*"
{
if ($state -eq [DiffState]::DiffContent)
{
$old = $_.Substring(1)
$Script:ScanResult["OriginalStrs"] += $old
}
}
"+*"
{
if ($state -eq [DiffState]::DiffContent)
{
$new = $_.Substring(1)
$Script:ScanResult["NewStrs"] += $new
}
}
}
Write-Host -Object "$($Log.Count) files involved in this PR`n"
foreach ($result in $Log.Values)
{
$newStrs = $result["NewStrs"]
$originalStrs = $result["OriginalStrs"]
for ($i = 0; $i -lt $originalStrs.Length; $i++)
{
$oldString = $originalStrs[$i]
$newString = $newStrs[$i]
$afterReplace = $oldString.Trim() + "."
$afterProcess = $newString.TrimStart()
if (!$afterProcess.StartsWith("///") -or $afterReplace -cne $afterProcess)
{
Write-Error -Message @"
$($result['FileName']) - mismatch
Old: $oldString
New: $newString
"@
}
}
}
if ($PassThru) { return $Log }
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The very first version of this script was published in gist years ago, at https://gist.github.com/daxian-dbw/3df8f9236a73a1d9b8c5cc913476d618
The scripts I used to validate this PR and the other one were slightly updated on top of the original one.
Or do you hope never see so large PRs? :-)
Well, I do wish we don't have huge PRs like this one, but it's inevitable for style changes 😄
|
vexx32 and iSazonov reacted with laugh emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
CL-CodeCleanup
Indicates that a PR should be marked as a Code Cleanup change in the Change Log
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|