Skip to content

Commit b7bc142

Browse files
HeyItsGilbertclaude
andcommitted
style: fix PSScriptAnalyzer violations across all source files
PSAvoidTrailingWhitespace (73): Strip trailing whitespace from all .ps1/.psm1 files under PSDepend/ and Tests/ PSPossibleIncorrectComparisonWithNull (4): Move $null to left-hand side in GitHub.ps1, Npm.ps1, Sort-WithCustomList.ps1 PSAvoidUsingCmdletAliases (1): Replace `select` with Select-Object in Invoke-PSDepend.ps1 PSUseOutputTypeCorrectly (27): Add [OutputType(...)] to Get-PSDependScript, Invoke-PSDepend, Sort-PSDependency, Test-Dotnet, Test-PlatformSupport, Validate-DependencyParameters, New-TestCredential, and Test-PSDependTypeSupportedHere Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 268eada commit b7bc142

77 files changed

Lines changed: 187 additions & 179 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

PSDepend/PSDepend.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Get public and private function definition files.
1+
#Get public and private function definition files.
22
$Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue )
33
$Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue )
44
$ModuleRoot = $PSScriptRoot

PSDepend/PSDependScripts/Chocolatey.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
Installs a Chocolatey package a repository.
44
@@ -306,4 +306,4 @@ if ($PSDependAction -contains 'Install') {
306306
}
307307
elseif ($PSDependAction -contains 'Test' -and $PSDependAction.count -eq 1) {
308308
return $false
309-
}
309+
}

PSDepend/PSDependScripts/Command.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
Invoke a PowerShell command
44
@@ -13,12 +13,12 @@
1313
Source: The code to run
1414
Parameters:
1515
FailOnError: If specified, throw a terminating error if the command errors out.
16-
16+
1717
.PARAMETER PSDependAction
1818
Only option is to install the module. Defaults to Install
1919
2020
Install: Install the dependency
21-
21+
2222
.PARAMETER Dependency
2323
Dependency to process
2424
@@ -63,4 +63,4 @@ foreach ($Depend in $Dependency) {
6363
}
6464
}
6565
}
66-
}
66+
}

PSDepend/PSDependScripts/DotnetSdk.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
Installs the .NET Core SDK.
44

PSDepend/PSDependScripts/FileDownload.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
Download a file
44
@@ -111,7 +111,7 @@ else {
111111
$FileName = Parse-URLForFile -URL $URL
112112
}
113113
$Path = Join-Path $Target $FileName
114-
114+
115115
if (Test-Path $Path -PathType Leaf) {
116116
Write-Verbose "Skipping existing file [$Path]"
117117
if ($PSDependAction -contains 'Test') {
@@ -137,7 +137,7 @@ if ($PSDependAction -contains 'Install' -and $ToInstall) {
137137
Get-WebFile -URL $URL -Path $Path
138138
}
139139

140-
if ($Dependency.AddToPath) {
140+
if ($Dependency.AddToPath) {
141141
Write-Verbose "Setting PATH to`n$($PathToAdd, $env:PATH -join ';' | Out-String)"
142142
Add-ToItemCollection -Reference Env:\Path -Item $PathToAdd
143143
}

PSDepend/PSDependScripts/FileSystem.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
EXPERIMENTAL: Use Robocopy or Copy-Item for folder and file dependencies, respectively.
44
@@ -86,7 +86,7 @@ foreach ($Source in @($Sources)) {
8686
continue
8787
}
8888
$IsContainer = ( Get-Item $Source ).PSIsContainer
89-
89+
9090
# Resolve PSDrives.
9191
$Target = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Target)
9292
$Source = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Source)
@@ -172,4 +172,4 @@ if ($PSDependAction -like 'Import') {
172172
}
173173
}
174174
Import-PSDependModule $ImportPath
175-
}
175+
}

PSDepend/PSDependScripts/Git.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
Clone a git repository
44
@@ -68,7 +68,7 @@ param(
6868
[string[]]$PSDependAction = @('Install'),
6969

7070
[string]$ImportPath,
71-
71+
7272
[bool]$ExtractProject = $False
7373
)
7474

@@ -170,7 +170,7 @@ elseif ($GottaInstall -and $ExtractProject) {
170170

171171
$null = New-Item -ItemType Directory -Path $OutPath -Force
172172
Push-Location $OutPath
173-
173+
174174
Write-Verbose -Message "Cloning dependency [$GitName] with git from [$($Target)]"
175175
Invoke-ExternalCommand git 'clone', $Name
176176

@@ -198,7 +198,7 @@ elseif ($GottaInstall -and $ExtractProject) {
198198
if ($Dependency.AddToPath) {
199199
Write-Verbose "Setting PSModulePath to`n$($Target, $env:PSModulePath -join ';' | Out-String)"
200200
Add-ToItemCollection -Reference Env:\PSModulePath -Item (Get-Item $Target).FullName
201-
201+
202202
Write-Verbose "Setting PATH to`n$($RepoPath, $env:PATH -join ';' | Out-String)"
203203
Add-ToItemCollection -Reference Env:\PATH -Item (Get-Item $Target).FullName
204204
}

PSDepend/PSDependScripts/GitHub.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
Installs a module from a GitHub repository.
44
@@ -313,7 +313,7 @@ if ($ShouldInstall) {
313313
$Page = 0
314314

315315
try {
316-
:nullcheck while ($GitHubVersion -Eq $null) {
316+
:nullcheck while ($null -eq $GitHubVersion) {
317317
$Page++
318318
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
319319
$GitHubTags = Invoke-RestMethod -Uri "https://api.github.com/repos/$DependencyID/tags?per_page=100&page=$Page"

PSDepend/PSDependScripts/Noop.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
Display variables that a dependency script would receive.
44
@@ -31,4 +31,4 @@ Write-Verbose "Starting noop run with $($Dependency.count) sources"
3131
DependencyParameters = $Dependency.Parameters
3232
GetVariable = (Get-Variable)
3333
ENV = Get-ChildItem ENV:
34-
}
34+
}

PSDepend/PSDependScripts/Npm.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#
1+
<#
22
.SYNOPSIS
33
Install a node package from NPM.
44
@@ -18,7 +18,7 @@
1818
1919
.PARAMETER Dependency
2020
Dependency to process
21-
21+
2222
.PARAMETER Global
2323
If specified, the node package will be installed globally.
2424
@@ -96,10 +96,10 @@ If ($PSDependAction -contains 'Test') {
9696
Pop-Location
9797
}
9898
$InstalledModule = $InstalledNodeModules.$Name
99-
If ($InstalledModule -eq $null) {
99+
If ($null -eq $InstalledModule) {
100100
return $false
101101
}
102-
ElseIf ($Version -ne $null -and $InstalledModule.Version -ne $Version) {
102+
ElseIf ($null -ne $Version -and $InstalledModule.Version -ne $Version) {
103103
return $false
104104
}
105105
Else {
@@ -121,4 +121,4 @@ If ($PSDependAction -contains 'Install') {
121121
Pop-Location
122122
}
123123
}
124-
#endregion Install Action
124+
#endregion Install Action

0 commit comments

Comments
 (0)