diff --git a/.vscode/settings.json b/.vscode/settings.json index d3d607d..75178a1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,5 +16,6 @@ "**/*.code-search": true, "**/.ruby-lsp": true, "Output/**": true - } -} \ No newline at end of file + }, + "snyk.advanced.autoSelectOrganization": true +} diff --git a/CHANGELOG.md b/CHANGELOG.md index fb6335f..c9ee827 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog + + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), diff --git a/Examples/ModuleDependencies.md b/Examples/ModuleDependencies.md index af1be7f..572cc9e 100644 --- a/Examples/ModuleDependencies.md +++ b/Examples/ModuleDependencies.md @@ -1,5 +1,7 @@ # Handling Module Dependencies + + `Install-Module` handles dependencies declared in a module manifest's `RequiredModules` section, but it only covers the PowerShell Gallery. PSDepend lets you declare dependencies from multiple sources — Gallery modules, Git repos, and file downloads — in one place. This walkthrough demonstrates embedding a `requirements.psd1` in a module so dependencies are resolved automatically on import. @@ -22,7 +24,7 @@ Invoke-PSDepend -Path $PSScriptRoot\Requirements.psd1 -Target $PSScriptRoot\Depe Import-Module Posh-SSH -Function Test-PSDependExample { +function Test-PSDependExample { Get-ChildItem $PSScriptRoot\Dependencies -Recurse -Depth 1 | Select-Object -ExpandProperty FullName Get-Module | Select-Object Name, Path } diff --git a/PSDepend/PSDepend.Format.ps1xml b/PSDepend/PSDepend.Format.ps1xml index 2ba92bf..9490b2b 100644 --- a/PSDepend/PSDepend.Format.ps1xml +++ b/PSDepend/PSDepend.Format.ps1xml @@ -21,7 +21,7 @@ - Try { ($_.Tags | Out-String ).trimend("`n")} Catch {$_.Tags} + Try { ($_.Tags | Out-String ).TrimEnd("`n")} Catch {$_.Tags} diff --git a/PSDepend/PSDependScripts/Chocolatey.ps1 b/PSDepend/PSDependScripts/Chocolatey.ps1 index 633667c..cc55355 100644 --- a/PSDepend/PSDependScripts/Chocolatey.ps1 +++ b/PSDepend/PSDependScripts/Chocolatey.ps1 @@ -1,4 +1,5 @@ -<# +# cspell:ignore lessmsi +<# .SYNOPSIS Installs a package from a Chocolatey repository. @@ -91,8 +92,7 @@ function Get-ChocoVersion { # Strip prerelease/build metadata (e.g. 2.2.2-beta) before parsing if ([System.Version]::TryParse(($rawVersion -replace '[-+].*$'), [ref]$parsedVersion)) { $parsedVersion - } - else { + } else { # Assume a modern CLI when the version cannot be determined [System.Version]'2.0' } @@ -243,8 +243,7 @@ if (-not (Get-Command -Name 'choco.exe' -ErrorAction SilentlyContinue)) { try { Invoke-WebRequest -UseBasicParsing -Uri $ChocoInstallScriptUrl -OutFile $scriptPath & $scriptPath - } - catch { + } catch { throw "Unable to install Chocolatey from '$ChocoInstallScriptUrl'." } } @@ -274,8 +273,7 @@ Write-Verbose "Getting package [$Name] version, if it is installed." $existingVersion = (Get-ChocoInstalledPackage -Name $Name).Version if ($existingVersion) { Write-Verbose "Found package [$Name] installed with version [$existingVersion]." -} -else { +} else { Write-Verbose "Package [$Name] not installed." } @@ -302,8 +300,7 @@ Write-Verbose "Getting latest package [$Name] version from source [$Source]." $repositoryVersion = (Get-ChocoLatestPackage @repoParams).Version if ($repositoryVersion) { Write-Verbose "Found package [$Name] version [$repositoryVersion] on source [$Source]." -} -else { +} else { Write-Verbose "Package [$Name] not found on source [$Source]. Nothing more can be done." return # cannot continue } @@ -318,14 +315,12 @@ $haveLatest = if ( [System.Management.Automation.SemanticVersion]::TryParse([string]$existingVersion, [ref]$parsedExistingSemanticVersion) ) { $parsedRepositorySemanticVersion -le $parsedExistingSemanticVersion -} -elseif ( +} elseif ( [System.Version]::TryParse([string]$repositoryVersion, [ref]$parsedRepositoryVersion) -and [System.Version]::TryParse([string]$existingVersion, [ref]$parsedExistingVersion) ) { $parsedRepositoryVersion -le $parsedExistingVersion -} -else { +} else { $false } if ($Version -eq 'latest' -and $haveLatest) { @@ -353,7 +348,6 @@ if ($PSDependAction -contains 'Install') { } Invoke-ChocoInstallPackage @params -} -elseif ($PSDependAction -contains 'Test' -and $PSDependAction.count -eq 1) { +} elseif ($PSDependAction -contains 'Test' -and $PSDependAction.count -eq 1) { return $false } diff --git a/PSDepend/PSDependScripts/Command.ps1 b/PSDepend/PSDependScripts/Command.ps1 index c1a4d40..decd93a 100644 --- a/PSDepend/PSDependScripts/Command.ps1 +++ b/PSDepend/PSDependScripts/Command.ps1 @@ -33,13 +33,13 @@ } } - # Run some aribtrary PowerShell code that assigns a variable and uses it in a string + # Run some arbitrary PowerShell code that assigns a variable and uses it in a string # Output: Running a command on WJ-LAB #> -[cmdletbinding()] +[CmdletBinding()] param ( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [switch]$FailOnError, diff --git a/PSDepend/PSDependScripts/DotnetSdk.ps1 b/PSDepend/PSDependScripts/DotnetSdk.ps1 index 795ab8b..3116232 100644 --- a/PSDepend/PSDependScripts/DotnetSdk.ps1 +++ b/PSDepend/PSDependScripts/DotnetSdk.ps1 @@ -44,13 +44,13 @@ } # Simple syntax - # The .NET SDK will be installed with the latest verion from the LTS channel, globally. + # The .NET SDK will be installed with the latest version from the LTS channel, globally. #> [CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject[]] + [PSObject[]] $Dependency, [ValidateSet('Test', 'Install', 'Import')] @@ -60,7 +60,7 @@ param( # Users can specify 'Global which will use the default global path of # "$env:LocalAppData\Microsoft\dotnet" on Windows or "$env:HOME/.dotnet" elsewhere -# Since Global is the default behavior, we ingore the fact that the Target was set. +# Since Global is the default behavior, we ignore the fact that the Target was set. $InstallDir = if ($Dependency.Target -and $Dependency.Target -ne 'Global') { $Dependency.Target } $Version = $Dependency.Version $Channel = if ($Dependency.DependencyName) { $Dependency.DependencyName } else { "release" } diff --git a/PSDepend/PSDependScripts/FileDownload.ps1 b/PSDepend/PSDependScripts/FileDownload.ps1 index b4e8ea5..f4122ba 100644 --- a/PSDepend/PSDependScripts/FileDownload.ps1 +++ b/PSDepend/PSDependScripts/FileDownload.ps1 @@ -1,4 +1,5 @@ -<# +# cspell:ignore extensionless sqllite +<# .SYNOPSIS Download a file @@ -35,10 +36,10 @@ # Downloads System.Data.SQLite.dll to C:\temp\sqlite.dll #> -[cmdletbinding()] +[CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject[]] + [PSObject[]] $Dependency, [ValidateSet('Test', 'Install')] @@ -46,7 +47,7 @@ param( ) function Parse-URLForFile { - [cmdletbinding()] + [CmdletBinding()] param($URL) # This will need work. Assume leaf is file. If CGI exists in leaf, assume it is after the file $FileName = $URL.split('/')[-1] diff --git a/PSDepend/PSDependScripts/FileSystem.ps1 b/PSDepend/PSDependScripts/FileSystem.ps1 index 68271e1..067fa37 100644 --- a/PSDepend/PSDependScripts/FileSystem.ps1 +++ b/PSDepend/PSDependScripts/FileSystem.ps1 @@ -1,4 +1,5 @@ -<# +# cspell:ignore psams +<# .SYNOPSIS EXPERIMENTAL: Use Robocopy or Copy-Item for folder and file dependencies, respectively. @@ -59,10 +60,10 @@ # Copy psams module to C:\ProjectX\psams #> -[cmdletbinding()] +[CmdletBinding()] param ( [PSTypeName('PSDepend.Dependency')] - [psobject[]] + [PSObject[]] $Dependency, [ValidateSet('Test', 'Install', 'Import')] diff --git a/PSDepend/PSDependScripts/Git.ps1 b/PSDepend/PSDependScripts/Git.ps1 index 3edd97f..dc9f9d4 100644 --- a/PSDepend/PSDependScripts/Git.ps1 +++ b/PSDepend/PSDependScripts/Git.ps1 @@ -1,4 +1,5 @@ -<# +# cspell:ignore jdoe TrimEnd +<# .SYNOPSIS Clone a git repository @@ -53,14 +54,14 @@ # Simple syntax # First example shows cloning PSDeploy from ramblingcookiemonster's GitHub repo - # Second example shows clonging BuildHelpers from jdoe's internal GitLab account and checking out a specific commit + # Second example shows cloning BuildHelpers from jdoe's internal GitLab account and checking out a specific commit # Both are cloned to the current path (e.g. .\) # This syntax assumes git as a source. The right hand side is the version (branch, commit, tags/, etc.) #> -[cmdletbinding()] +[CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [switch]$Force, @@ -84,16 +85,14 @@ if (-not $Name) { if ($Name -match "^[a-zA-Z0-9]+/[a-zA-Z0-9_-]+$") { $Name = "https://github.com/$Name.git" } -$GitName = $Name.trimend('/').split('/')[-1] -replace "\.git$", '' +$GitName = $Name.TrimEnd('/').split('/')[-1] -replace "\.git$", '' if ($Dependency.Target -and ($Target = (Get-Item $Dependency.Target -ErrorAction SilentlyContinue).FullName)) { Write-Debug "Target resolved to $Target" -} -else { +} else { if ($Dependency.Target) { $Target = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Dependency.Target) Write-Debug "Target $($Dependency.Target) does not exist yet, will be created" - } - else { + } else { $Target = $PWD.Path Write-Debug "Target defaulted to current dir: $Target" } @@ -111,8 +110,8 @@ if (-not (Test-Path $RepoPath)) { if ( $PSDependAction -contains 'Test' -and $PSDependAction.count -eq 1) { return $False } -} -else { # Target exists +} else { + # Target exists $GottaTest = $True } @@ -129,8 +128,8 @@ if (-not $Version) { if ($GottaTest) { Push-Location Set-Location $RepoPath - $Branch = Invoke-ExternalCommand git -Arguments (Write-Output rev-parse --abbrev-ref HEAD) -Passthru - $Commit = Invoke-ExternalCommand git -Arguments (Write-Output rev-parse HEAD) -Passthru + $Branch = Invoke-ExternalCommand git -Arguments (Write-Output rev-parse --abbrev-ref HEAD) -PassThru + $Commit = Invoke-ExternalCommand git -Arguments (Write-Output rev-parse HEAD) -PassThru Pop-Location if (-not $Branch) { Write-Warning "[$RepoPath] exists but does not appear to be a valid git repository. Skipping [$DependencyName]." @@ -138,19 +137,16 @@ if ($GottaTest) { return $false } $GottaInstall = $False - } - elseif ($Version -eq $Branch -or $Version -eq $Commit) { + } elseif ($Version -eq $Branch -or $Version -eq $Commit) { Write-Verbose "[$RepoPath] exists and is already at version [$Version]" if ($PSDependAction -contains 'Test' -and $PSDependAction.count -eq 1) { return $true } $GottaInstall = $False - } - elseif ($PSDependAction -contains 'Test' -and $PSDependAction.count -eq 1) { + } elseif ($PSDependAction -contains 'Test' -and $PSDependAction.count -eq 1) { Write-Verbose "[$RepoPath] exists and is at branch [$Branch], commit [$Commit].`nWe don't currently support moving to the requested version [$Version]" return $false - } - else { + } else { Write-Verbose "[$RepoPath] exists and is at branch [$Branch], commit [$Commit].`nWe don't currently support moving to the requested version [$Version]" $GottaInstall = $False } @@ -171,8 +167,7 @@ if ($GottaInstall -and !$ExtractProject) { Write-Verbose -Message "Checking out [$Version] of [$Name] from [$RepoPath]" Invoke-ExternalCommand git 'checkout', $Version Pop-Location -} -elseif ($GottaInstall -and $ExtractProject) { +} elseif ($GottaInstall -and $ExtractProject) { $OutPath = Join-Path ([System.IO.Path]::GetTempPath()) ([guid]::NewGuid().guid) $RepoFolder = Join-Path -Path $OutPath -ChildPath $GitName diff --git a/PSDepend/PSDependScripts/GitHub.ps1 b/PSDepend/PSDependScripts/GitHub.ps1 index b431646..db7f35e 100644 --- a/PSDepend/PSDependScripts/GitHub.ps1 +++ b/PSDepend/PSDependScripts/GitHub.ps1 @@ -1,4 +1,5 @@ -<# +# cspell:ignore branchname bundyfx Dargmuesli Finke nullcheck psslack Thelemann versionslocal versionsremote zipball +<# .SYNOPSIS Installs a module from a GitHub repository. @@ -153,10 +154,10 @@ # This downloads the latest version of demo_ci by powershell from GitHub. # Then it extracts "repo-root/Assets/DscPipelineTools" and "repo-root/InfraDNS/Configs/DNSServer.ps1" to the target. #> -[cmdletbinding()] +[CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [ValidateSet('Test', 'Install', 'Import')] [string[]]$PSDependAction = @('Install'), @@ -180,7 +181,11 @@ Write-Verbose -Message "Am I on Windows? [$script:IsWindows]! Am I PS Core? [$sc $DependencyID = $Dependency.DependencyName $DependencyVersion = $Dependency.Version $DependencyTarget = $Dependency.Target -$DependencyName = if ($Dependency.Name) { $Dependency.Name } Else { $DependencyID.Split("/")[1] } +$DependencyName = if ($Dependency.Name) { + $Dependency.Name +} else { + $DependencyID.Split("/")[1] +} # Translate "" to "latest" if ($DependencyVersion -eq "") { @@ -194,24 +199,21 @@ if ($DependencyVersion -match "^\d+(?:\.\d+)+$") { if ($script:IsCoreCLR) { $ModuleChildPath = "PowerShell\Modules" -} -else { +} else { $ModuleChildPath = "WindowsPowerShell\Modules" } # Get system installation path if ($script:IsWindows) { $AllUsersPath = Join-Path -Path $env:ProgramFiles -ChildPath $ModuleChildPath -} -else { +} else { $AllUsersPath = [System.Management.Automation.Platform]::SelectProductNameForDirectory('SHARED_MODULES') } # Check if the MyDocuments folder path is accessible try { $MyDocumentsFolderPath = [Environment]::GetFolderPath("MyDocuments") -} -catch { +} catch { $MyDocumentsFolderPath = $null } @@ -219,34 +221,28 @@ catch { if ($script:IsWindows) { if ($MyDocumentsFolderPath) { $CurrentUserPath = Join-Path -Path $MyDocumentsFolderPath -ChildPath $ModuleChildPath - } - else { + } else { $CurrentUserPath = Join-Path -Path $HOME -ChildPath "Documents\$ModuleChildPath" } -} -else { +} else { $CurrentUserPath = [System.Management.Automation.Platform]::SelectProductNameForDirectory('USER_MODULES') } # Set target path if ($DependencyTarget) { # Resolve scope keywords - if ($DependencyTarget -Eq "CurrentUser") { + if ($DependencyTarget -eq "CurrentUser") { $TargetPath = $CurrentUserPath - } - elseif ($DependencyTarget -Eq "AllUsers") { + } elseif ($DependencyTarget -eq "AllUsers") { $TargetPath = $AllUsersPath - } - else { + } else { $TargetPath = $DependencyTarget } -} -else { +} else { # Set default target depending on admin permissions - if (($script:IsWindows) -And (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))) { + if (($script:IsWindows) -and (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))) { $TargetPath = $AllUsersPath - } - else { + } else { $TargetPath = $CurrentUserPath } } @@ -268,8 +264,7 @@ $URL = $null if ($Module) { $ModuleExisting = $true -} -else { +} else { $ModuleExisting = $false } @@ -294,13 +289,11 @@ if ($ModuleExisting) { } } } - } - else { + } else { # The version that is to be used is probably a GitHub branch name $ShouldInstall = $true } -} -else { +} else { Write-Verbose "Did not find existing module [$DependencyName]" $ShouldInstall = $true } @@ -323,7 +316,7 @@ if ($ShouldInstall) { if ($GitHubTag.name -match "^v?\d+(?:\.\d+)+$" -and ($DependencyVersion -match "^\d+(?:\.\d+)+$" -or $DependencyVersion -eq "latest")) { $GitHubVersion = New-Object "System.Version" ($GitHubTag.name -replace '^v', '') - if ($DependencyVersion -Eq "latest") { + if ($DependencyVersion -eq "latest") { $DependencyVersion = $GitHubVersion } @@ -344,13 +337,11 @@ if ($ShouldInstall) { } } } - } - else { + } else { break nullcheck } } - } - catch { + } catch { # Repository does not seem to exist or a branch is the target $ShouldInstall = $false Write-Warning "Could not find module on GitHub: $_" @@ -377,8 +368,7 @@ if ($ShouldInstall) { } } } - } - else { + } else { Write-Verbose "[$DependencyID] has no tags on GitHub or [$DependencyVersion] is a branchname" # Translate version "latest" to "main" if ($DependencyVersion -eq "latest") { @@ -426,18 +416,15 @@ if (($PSDependAction -contains 'Install') -and $ShouldInstall) { $AbsolutePath = Join-Path $OutPath $RelativePath if (-not (Test-Path $AbsolutePath)) { Write-Warning "Expected ExtractPath [$RelativePath], did not find at [$AbsolutePath]" - } - else { + } else { $AbsolutePath } } - } - elseif ($ExtractProject) { + } elseif ($ExtractProject) { # Filter only the project contents $ProjectDetails = Get-ProjectDetail -Path $OutPath [string[]]$ToCopy = $ProjectDetails.Path - } - else { + } else { # Use the standard download path [string[]]$ToCopy = $OutPath } @@ -453,21 +440,17 @@ if (($PSDependAction -contains 'Install') -and $ShouldInstall) { if ($TargetType -eq 'Exact') { $Destination = $TargetPath - } - elseif ($DependencyVersion -match "^\d+(?:\.\d+)+$" -and $PSVersionTable.PSVersion -ge '5.0' ) { + } elseif ($DependencyVersion -match "^\d+(?:\.\d+)+$" -and $PSVersionTable.PSVersion -ge '5.0' ) { # For versioned GitHub tags $Destination = Join-Path $TargetPath $DependencyVersion - } - elseif (($DependencyVersion -eq "latest") -and ($RemoteAvailable) -and $PSVersionTable.PSVersion -ge '5.0' ) { + } elseif (($DependencyVersion -eq "latest") -and ($RemoteAvailable) -and $PSVersionTable.PSVersion -ge '5.0' ) { # For latest GitHub tags $Destination = Join-Path $TargetPath $GitHubVersion - } - elseif ($PSVersionTable.PSVersion -ge '5.0' -and $TargetType -eq 'Parallel') { + } elseif ($PSVersionTable.PSVersion -ge '5.0' -and $TargetType -eq 'Parallel') { # For GitHub branches $Destination = Join-Path $TargetPath $DependencyVersion $Destination = Join-Path $Destination $DependencyName - } - else { + } else { $Destination = $TargetPath } @@ -489,8 +472,7 @@ if (($PSDependAction -contains 'Install') -and $ShouldInstall) { # Conditional import if ($ModuleExisting) { Import-PSDependModule -Name $TargetPath -Action $PSDependAction -} -elseif ($PSDependAction -contains 'Import') { +} elseif ($PSDependAction -contains 'Import') { Write-Warning "[$DependencyName] at [$TargetPath] should be imported, but does not exist" } diff --git a/PSDepend/PSDependScripts/Noop.ps1 b/PSDepend/PSDependScripts/Noop.ps1 index f5cc7db..4ce255c 100644 --- a/PSDepend/PSDependScripts/Noop.ps1 +++ b/PSDepend/PSDependScripts/Noop.ps1 @@ -15,10 +15,10 @@ .PARAMETER StringParameter An example parameter that does nothing #> -[cmdletbinding()] +[CmdletBinding()] param ( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [string[]]$StringParameter ) diff --git a/PSDepend/PSDependScripts/Npm.ps1 b/PSDepend/PSDependScripts/Npm.ps1 index 5ddfa12..32dd211 100644 --- a/PSDepend/PSDependScripts/Npm.ps1 +++ b/PSDepend/PSDependScripts/Npm.ps1 @@ -51,13 +51,13 @@ # Simple syntax # The example package, 'gitbook-cli' will be installed - at the latest verion from NPM to the current directory. + at the latest version from NPM to the current directory. #> -[cmdletbinding()] +[CmdletBinding()] param ( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [ValidateSet('Test', 'Install')] [string[]]$PSDependAction = @('Install'), diff --git a/PSDepend/PSDependScripts/Nuget.ps1 b/PSDepend/PSDependScripts/Nuget.ps1 index f0e714f..143ce4a 100644 --- a/PSDepend/PSDependScripts/Nuget.ps1 +++ b/PSDepend/PSDependScripts/Nuget.ps1 @@ -1,4 +1,5 @@ -<# +# cspell:ignore Newtonsoft +<# .SYNOPSIS Installs a package from a Nuget repository like Nuget.org using nuget.exe @@ -65,10 +66,10 @@ # Installs the list of Nuget packages from Nuget.org using the Global PSDependOptions to limit repetition. Packages will be downloaded to the Staging directory in the current working directory. Since the DLL included with Portable.BouncyCastle is actually named 'BouncyCastle.Crypto', we specify that in the parameters. #> -[cmdletbinding()] +[CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [switch]$Force, diff --git a/PSDepend/PSDependScripts/PSGalleryModule.ps1 b/PSDepend/PSDependScripts/PSGalleryModule.ps1 index d0eb680..c6dbee7 100644 --- a/PSDepend/PSDependScripts/PSGalleryModule.ps1 +++ b/PSDepend/PSDependScripts/PSGalleryModule.ps1 @@ -91,10 +91,10 @@ } # Install the latest version of PowerCLI, allowing for prerelease #> -[cmdletbinding()] +[CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [AllowNull()] [string]$Repository = 'PSGallery', # From Parameters... diff --git a/PSDepend/PSDependScripts/PSGalleryNuget.ps1 b/PSDepend/PSDependScripts/PSGalleryNuget.ps1 index 4bc9a96..f9c6ece 100644 --- a/PSDepend/PSDependScripts/PSGalleryNuget.ps1 +++ b/PSDepend/PSDependScripts/PSGalleryNuget.ps1 @@ -53,10 +53,10 @@ # Install the latest version of PSDeploy on an internal nuget feed, to C:\temp, #> -[cmdletbinding()] +[CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [switch]$Force, diff --git a/PSDepend/PSDependScripts/PSResourceGet.ps1 b/PSDepend/PSDependScripts/PSResourceGet.ps1 index 84d09cd..0eec9d5 100644 --- a/PSDepend/PSDependScripts/PSResourceGet.ps1 +++ b/PSDepend/PSDependScripts/PSResourceGet.ps1 @@ -122,7 +122,7 @@ [CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [AllowNull()] [string]$Repository = 'PSGallery', diff --git a/PSDepend/PSDependScripts/Package.ps1 b/PSDepend/PSDependScripts/Package.ps1 index 4332ec6..eef10fd 100644 --- a/PSDepend/PSDependScripts/Package.ps1 +++ b/PSDepend/PSDependScripts/Package.ps1 @@ -1,4 +1,5 @@ -<# +# cspell:ignore jquery +<# .SYNOPSIS EXPERIMENTAL: Installs a package using the PackageManagement module @@ -50,10 +51,10 @@ # Install jquery from my internal nuget feed to C:\MyProject #> -[cmdletbinding()] +[CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [ValidateSet('Test', 'Install')] [string[]]$PSDependAction = @('Install'), diff --git a/PSDepend/PSDependScripts/Task.ps1 b/PSDepend/PSDependScripts/Task.ps1 index 770fccb..73439ec 100644 --- a/PSDepend/PSDependScripts/Task.ps1 +++ b/PSDepend/PSDependScripts/Task.ps1 @@ -1,4 +1,5 @@ -<# +# cspell:ignore prestage +<# .SYNOPSIS Support dependencies by handling simple tasks. @@ -45,10 +46,10 @@ # Run Example.ps1 from the current directory # Alternatively, you can use $DependencyPath to refer to the folder containing this dependency file #> -[cmdletbinding()] +[CmdletBinding()] param ( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [ValidateSet('Install')] [string[]]$PSDependAction = @('Install') # No logic for this diff --git a/PSDepend/PSDependScripts/WindowsRSAT.ps1 b/PSDepend/PSDependScripts/WindowsRSAT.ps1 index dde0612..bc5d528 100644 --- a/PSDepend/PSDependScripts/WindowsRSAT.ps1 +++ b/PSDepend/PSDependScripts/WindowsRSAT.ps1 @@ -1,4 +1,5 @@ -<# +# cspell:ignore ADCS ADRMS DFSN DFSR DISM FSRM GPMC Mgmt RSAT VAMT +<# .SYNOPSIS 'Install a WindowsRSAT PowerShell module using Add-WindowsCapability or Install-WindowsFeature, depending on OS' @@ -28,10 +29,10 @@ } } #> -[cmdletbinding()] +[CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [ValidateSet('Test', 'Install', 'Import')] [string[]]$PSDependAction = @('Install') diff --git a/PSDepend/Private/Add-ObjectDetail.ps1 b/PSDepend/Private/Add-ObjectDetail.ps1 index aefa7f7..1f0519f 100644 --- a/PSDepend/Private/Add-ObjectDetail.ps1 +++ b/PSDepend/Private/Add-ObjectDetail.ps1 @@ -1,4 +1,5 @@ -function Add-ObjectDetail { +# cspell:ignore ddps noteproperties +function Add-ObjectDetail { <# .SYNOPSIS Decorate an object with @@ -35,7 +36,7 @@ .PARAMETER DefaultProperties Change the default properties that show up - .PARAMETER Passthru + .PARAMETER PassThru Whether to pass the resulting object on. Defaults to true .EXAMPLE @@ -104,7 +105,7 @@ Position = 0, ValueFromPipeline = $true )] [ValidateNotNullOrEmpty()] - [psobject[]]$InputObject, + [PSObject[]]$InputObject, [Parameter( Mandatory = $false, Position = 1)] @@ -120,17 +121,17 @@ [Alias('dp')] [System.String[]]$DefaultProperties, - [boolean]$Passthru = $True + [boolean]$PassThru = $True ) - Begin { + begin { if ($PSBoundParameters.ContainsKey('DefaultProperties')) { # define a subset of properties $ddps = New-Object System.Management.Automation.PSPropertySet DefaultDisplayPropertySet, $DefaultProperties $PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]$ddps } } - Process { + process { foreach ($Object in $InputObject) { switch ($PSBoundParameters.Keys) { 'PropertyToAdd' { @@ -148,7 +149,7 @@ Add-Member -InputObject $Object -MemberType MemberSet -Name PSStandardMembers -Value $PSStandardMembers } } - if ($Passthru) { + if ($PassThru) { $Object } } diff --git a/PSDepend/Private/Add-ToPsModulePathIfRequired.ps1 b/PSDepend/Private/Add-ToPsModulePathIfRequired.ps1 index ae0235c..442e683 100644 --- a/PSDepend/Private/Add-ToPsModulePathIfRequired.ps1 +++ b/PSDepend/Private/Add-ToPsModulePathIfRequired.ps1 @@ -1,8 +1,8 @@ function Add-ToPsModulePathIfRequired { - [cmdletbinding()] + [CmdletBinding()] param( [PSTypeName('PSDepend.Dependency')] - [psobject]$Dependency, + [PSObject]$Dependency, [string[]]$Action ) diff --git a/PSDepend/Private/Bootstrap-Nuget.ps1 b/PSDepend/Private/Bootstrap-Nuget.ps1 index d543018..a4e6904 100644 --- a/PSDepend/Private/Bootstrap-Nuget.ps1 +++ b/PSDepend/Private/Bootstrap-Nuget.ps1 @@ -1,6 +1,6 @@ # Check for nuget exe. If it doesn't exist, create full path to parent, and download it function BootStrap-Nuget { - [cmdletbinding()] + [CmdletBinding()] param( $NugetPath = "$env:APPDATA\nuget.exe" ) diff --git a/PSDepend/Private/Find-NugetPackage.ps1 b/PSDepend/Private/Find-NugetPackage.ps1 index 3d84d37..1e26a61 100644 --- a/PSDepend/Private/Find-NugetPackage.ps1 +++ b/PSDepend/Private/Find-NugetPackage.ps1 @@ -15,7 +15,7 @@ function Find-NugetPackage { [string]$Version, # If specified, gets passed during the Nuget source call - [pscredential]$Credential = $null + [PSCredential]$Credential = $null ) #Ugly way to do this. Prefer islatest, otherwise look for version, otherwise grab all matching modules diff --git a/PSDepend/Private/Get-Hash.ps1 b/PSDepend/Private/Get-Hash.ps1 index 82b15c5..7edb30a 100644 --- a/PSDepend/Private/Get-Hash.ps1 +++ b/PSDepend/Private/Get-Hash.ps1 @@ -1,10 +1,11 @@ -function Get-Hash { +# cspell:ignore procexp procmon pstypenames RIPEMD tcpview +function Get-Hash { <# .SYNOPSIS - Calculates the hash on a given file based on the seleced hash algorithm. + Calculates the hash on a given file based on the selected hash algorithm. .DESCRIPTION - Calculates the hash on a given file based on the seleced hash algorithm. Multiple hashing + Calculates the hash on a given file based on the selected hash algorithm. Multiple hashing algorithms can be used with this command. .PARAMETER Path @@ -21,7 +22,7 @@ SHA256 (Default) SHA384 SHA512 - RIPEM160 + RIPEMD160 .NOTES Name: Get-FileHash diff --git a/PSDepend/Private/Get-NodeModule.ps1 b/PSDepend/Private/Get-NodeModule.ps1 index 2817a58..3d9b535 100644 --- a/PSDepend/Private/Get-NodeModule.ps1 +++ b/PSDepend/Private/Get-NodeModule.ps1 @@ -1,10 +1,9 @@ -Function Get-NodeModule { - [cmdletbinding()] - Param([switch]$Global) - If ($Global -eq $true) { +function Get-NodeModule { + [CmdletBinding()] + param([switch]$Global) + if ($Global -eq $true) { (npm ls --json --silent --global | ConvertFrom-Json).dependencies - } - Else { + } else { (npm ls --json --silent | ConvertFrom-Json).dependencies } } diff --git a/PSDepend/Private/Get-Parameter.ps1 b/PSDepend/Private/Get-Parameter.ps1 index 5618dfe..2c56ff3 100644 --- a/PSDepend/Private/Get-Parameter.ps1 +++ b/PSDepend/Private/Get-Parameter.ps1 @@ -1,5 +1,6 @@ -# Borrowed from http://poshcode.org/5929 with a minor tweak for validateset - thanks all! -Function Get-Parameter { +# cspell:ignore paramset parameterset pstypenames +# Borrowed from http://poshcode.org/5929 with a minor tweak for ValidateSet - thanks all! +function Get-Parameter { #.Synopsis # Enumerates the parameters of one or more commands #.Description @@ -17,7 +18,7 @@ Function Get-Parameter { [Alias("Name")] [string[]]$CommandName, - # The parameter name to filter by (allows Wilcards) + # The parameter name to filter by (allows Wildcards) [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true, ParameterSetName = "FilterNames")] [string[]]$ParameterName = "*", diff --git a/PSDepend/Private/Get-ParameterName.ps1 b/PSDepend/Private/Get-ParameterName.ps1 index 1ee8753..3d516e5 100644 --- a/PSDepend/Private/Get-ParameterName.ps1 +++ b/PSDepend/Private/Get-ParameterName.ps1 @@ -1,6 +1,7 @@ -Function Get-ParameterName { +# cspell:ignore parameterset +function Get-ParameterName { #Get parameter names for a specific command - [cmdletbinding()] + [CmdletBinding()] param( [string]$command, [string]$parameterset = $null, @@ -15,7 +16,7 @@ "PipelineVariable", "Confirm", "Whatif" ), - [string[]]$exclude = $( "Passthru", "Commit" ) + [string[]]$exclude = $( "PassThru", "Commit" ) ) if ($parameterset) { ((Get-Command -Name $command).ParameterSets | Where-Object { $_.name -eq $parameterset } ).Parameters.Name | Where-Object { ($exclude + $excludeDefault) -notcontains $_ } diff --git a/PSDepend/Private/Get-ProjectDetail.ps1 b/PSDepend/Private/Get-ProjectDetail.ps1 index 689b8cc..8935746 100644 --- a/PSDepend/Private/Get-ProjectDetail.ps1 +++ b/PSDepend/Private/Get-ProjectDetail.ps1 @@ -1,4 +1,5 @@ -# Borrowed and tweaked from BuildHelpers. TODO: Doc, commit back there +# cspell:ignore currentfolder subfolders +# Borrowed and tweaked from BuildHelpers. TODO: Doc, commit back there function Get-ProjectDetail { <# .SYNOPSIS @@ -36,12 +37,12 @@ function Get-ProjectDetail { .LINK about_BuildHelpers #> - [cmdletbinding()] + [CmdletBinding()] param( $Path = $PWD.Path ) - Function Resolve-ProjectDetail { + function Resolve-ProjectDetail { param( $Path = $Path, $RelativePath = '\', diff --git a/PSDepend/Private/Get-PropertyOrder.ps1 b/PSDepend/Private/Get-PropertyOrder.ps1 index e879ba5..c3f710e 100644 --- a/PSDepend/Private/Get-PropertyOrder.ps1 +++ b/PSDepend/Private/Get-PropertyOrder.ps1 @@ -1,5 +1,5 @@ #function to extract properties -Function Get-PropertyOrder { +function Get-PropertyOrder { <# .SYNOPSIS Gets property order for specified object @@ -10,8 +10,8 @@ Function Get-PropertyOrder { .PARAMETER InputObject A single object to convert to an array of property value pairs. - .PARAMETER Membertype - Membertypes to include + .PARAMETER MemberType + MemberTypes to include .PARAMETER ExcludeProperty Specific properties to exclude @@ -19,12 +19,12 @@ Function Get-PropertyOrder { .FUNCTIONALITY PowerShell Language #> - [cmdletbinding()] + [CmdletBinding()] param( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromRemainingArguments = $false)] [PSObject]$InputObject, - [validateset("AliasProperty", "CodeProperty", "Property", "NoteProperty", "ScriptProperty", + [ValidateSet("AliasProperty", "CodeProperty", "Property", "NoteProperty", "ScriptProperty", "Properties", "PropertySet", "Method", "CodeMethod", "ScriptMethod", "Methods", "ParameterizedProperty", "MemberSet", "Event", "Dynamic", "All")] [string[]]$MemberType = @( "NoteProperty", "Property", "ScriptProperty" ), @@ -46,8 +46,8 @@ Function Get-PropertyOrder { end { #Get properties that meet specified parameters - $firstObject.psobject.properties | - Where-Object { $memberType -contains $_.memberType } | + $firstObject.PSObject.properties | + Where-Object { $MemberType -contains $_.MemberType } | Select-Object -ExpandProperty Name | Where-Object { -not $excludeProperty -or $excludeProperty -notcontains $_ } } diff --git a/PSDepend/Private/Get-TaggedDependency.ps1 b/PSDepend/Private/Get-TaggedDependency.ps1 index ea062f0..0061d07 100644 --- a/PSDepend/Private/Get-TaggedDependency.ps1 +++ b/PSDepend/Private/Get-TaggedDependency.ps1 @@ -1,4 +1,4 @@ -Function Get-TaggedDependency { +function Get-TaggedDependency { param( [object[]]$Dependency, [string[]]$Tags diff --git a/PSDepend/Private/Get-WebFile.ps1 b/PSDepend/Private/Get-WebFile.ps1 index f54a98c..453da09 100644 --- a/PSDepend/Private/Get-WebFile.ps1 +++ b/PSDepend/Private/Get-WebFile.ps1 @@ -1,5 +1,6 @@ -# Wrapped for pester mocking... -Function Get-WebFile { +# cspell:ignore webclient +# Wrapped for pester mocking... +function Get-WebFile { param($URL, $Path) # We have the info, check for file, download it! [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 diff --git a/PSDepend/Private/Import-PSDependModule.ps1 b/PSDepend/Private/Import-PSDependModule.ps1 index d4decbf..f59f15e 100644 --- a/PSDepend/Private/Import-PSDependModule.ps1 +++ b/PSDepend/Private/Import-PSDependModule.ps1 @@ -1,5 +1,5 @@ function Import-PSDependModule { - [cmdletbinding()] + [CmdletBinding()] param ( [string[]]$Name = $ModulePath, $Action = $PSDependAction, diff --git a/PSDepend/Private/Install-NodeModule.ps1 b/PSDepend/Private/Install-NodeModule.ps1 index 950057c..9c6bf2f 100644 --- a/PSDepend/Private/Install-NodeModule.ps1 +++ b/PSDepend/Private/Install-NodeModule.ps1 @@ -1,5 +1,5 @@ -Function Install-NodeModule { - [cmdletbinding()] +function Install-NodeModule { + [CmdletBinding()] Param( [string]$Version, [switch]$Global, diff --git a/PSDepend/Private/Invoke-ExternalCommand.ps1 b/PSDepend/Private/Invoke-ExternalCommand.ps1 index 252925d..d7dd7c2 100644 --- a/PSDepend/Private/Invoke-ExternalCommand.ps1 +++ b/PSDepend/Private/Invoke-ExternalCommand.ps1 @@ -1,14 +1,14 @@ # Pester wasn't mocking git... # Borrowed idea from https://github.com/pester/Pester/issues/415 function Invoke-ExternalCommand { - [cmdletbinding()] - param($Command, [string[]]$Arguments, [switch]$Passthru) + [CmdletBinding()] + param($Command, [string[]]$Arguments, [switch]$PassThru) Write-Verbose "Running $Command with arguments $($Arguments -join "; ")" $result = $null $result = & $command @arguments Write-Verbose "$($result | Out-String)" - if ($Passthru) { + if ($PassThru) { $Result } } diff --git a/PSDepend/Private/SemanticVersion.ps1 b/PSDepend/Private/SemanticVersion.ps1 index 71fe12b..6a2c03d 100644 --- a/PSDepend/Private/SemanticVersion.ps1 +++ b/PSDepend/Private/SemanticVersion.ps1 @@ -1,4 +1,5 @@ -$code = @' +# cspell:ignore cref paramref psobj RIPEMD symver +$code = @' using System.Globalization; using System.Text; using System.Text.RegularExpressions; @@ -85,7 +86,7 @@ namespace System.Management.Automation public SemanticVersion(int major, int minor, int patch, string label) : this(major, minor, patch) { - // We presume the SymVer : + // We presume the SemVer : // 1) major.minor.patch-label // 2) 'label' starts with letter or digit. if (!string.IsNullOrEmpty(label)) @@ -238,7 +239,7 @@ namespace System.Management.Automation /// - /// PreReleaseLabel position in the SymVer string 'major.minor.patch-PreReleaseLabel+BuildLabel'. + /// PreReleaseLabel position in the SemVer string 'major.minor.patch-PreReleaseLabel+BuildLabel'. /// private string preReleaseLabel; @@ -249,7 +250,7 @@ namespace System.Management.Automation /// - /// BuildLabel position in the SymVer string 'major.minor.patch-PreReleaseLabel+BuildLabel'. + /// BuildLabel position in the SemVer string 'major.minor.patch-PreReleaseLabel+BuildLabel'. /// private string buildLabel; @@ -318,7 +319,7 @@ namespace System.Management.Automation string preLabel = null; string buildLabel = null; - // We parse the SymVer 'version' string 'major.minor.patch-PreReleaseLabel+BuildLabel'. + // We parse the SemVer 'version' string 'major.minor.patch-PreReleaseLabel+BuildLabel'. var dashIndex = version.IndexOf('-'); var plusIndex = version.IndexOf('+'); @@ -474,7 +475,7 @@ namespace System.Management.Automation /// /// Implement . - /// Meets SymVer 2.0 p.11 https://semver.org/ + /// Meets SemVer 2.0 p.11 https://semver.org/ /// public int CompareTo(SemanticVersion value) { @@ -490,7 +491,7 @@ namespace System.Management.Automation if (Patch != value.Patch) return Patch > value.Patch ? 1 : -1; - // SymVer 2.0 standard requires to ignore 'BuildLabel' (Build metadata). + // SemVer 2.0 standard requires to ignore 'BuildLabel' (Build metadata). return ComparePreLabel(this.PreReleaseLabel, value.PreReleaseLabel); } @@ -507,7 +508,7 @@ namespace System.Management.Automation /// public bool Equals(SemanticVersion other) { - // SymVer 2.0 standard requires to ignore 'BuildLabel' (Build metadata). + // SemVer 2.0 standard requires to ignore 'BuildLabel' (Build metadata). return other != null && (Major == other.Major) && (Minor == other.Minor) && (Patch == other.Patch) && string.Equals(PreReleaseLabel, other.PreReleaseLabel, StringComparison.Ordinal); @@ -576,7 +577,7 @@ namespace System.Management.Automation private static int ComparePreLabel(string preLabel1, string preLabel2) { - // Symver 2.0 standard p.9 + // SemVer 2.0 standard p.9 // Pre-release versions have a lower precedence than the associated normal version. // Comparing each dot separated identifier from left to right // until a difference is found as follows: diff --git a/PSDepend/Private/Sort-PSDependency.ps1 b/PSDepend/Private/Sort-PSDependency.ps1 index 6a9673b..0853326 100644 --- a/PSDepend/Private/Sort-PSDependency.ps1 +++ b/PSDepend/Private/Sort-PSDependency.ps1 @@ -1,5 +1,5 @@ function Sort-PSDependency { - [cmdletbinding()] + [CmdletBinding()] [OutputType([object[]])] param( [object[]]$Dependencies diff --git a/PSDepend/Private/Sort-WithCustomList.ps1 b/PSDepend/Private/Sort-WithCustomList.ps1 index 0016550..5026b8b 100644 --- a/PSDepend/Private/Sort-WithCustomList.ps1 +++ b/PSDepend/Private/Sort-WithCustomList.ps1 @@ -1,5 +1,5 @@ # Thanks to https://gallery.technet.microsoft.com/scriptcenter/Sort-With-Custom-List-07b1d93a -Function Sort-ObjectWithCustomList { +function Sort-ObjectWithCustomList { Param ( [parameter(ValueFromPipeline = $true)] [PSObject] diff --git a/PSDepend/Private/Validate-DependencyParameters.ps1 b/PSDepend/Private/Validate-DependencyParameters.ps1 index bfc5111..28418a9 100644 --- a/PSDepend/Private/Validate-DependencyParameters.ps1 +++ b/PSDepend/Private/Validate-DependencyParameters.ps1 @@ -1,5 +1,5 @@ function Validate-DependencyParameters { - [cmdletbinding()] + [CmdletBinding()] [OutputType([bool])] param( [string[]]$Required, diff --git a/PSDepend/Public/Get-Dependency.ps1 b/PSDepend/Public/Get-Dependency.ps1 index b1935cc..854c39c 100644 --- a/PSDepend/Public/Get-Dependency.ps1 +++ b/PSDepend/Public/Get-Dependency.ps1 @@ -1,4 +1,5 @@ -function Get-Dependency { +# cspell:ignore paramset +function Get-Dependency { <# .SYNOPSIS Read a dependency psd1 file @@ -25,7 +26,7 @@ These are parsed from dependency PSD1 files as follows: - Simple syntax, intepreted: + Simple syntax, interpreted: @{ DependencyName = 'Version' } @@ -128,7 +129,7 @@ .LINK https://github.com/PowerShellOrg/PSDepend #> - [cmdletbinding(DefaultParameterSetName = 'File')] + [CmdletBinding(DefaultParameterSetName = 'File')] param( [parameter(ParameterSetName = 'File')] [string[]]$Path = $PWD.Path, @@ -146,7 +147,7 @@ [hashtable]$Credentials ) - # Helper to pick from global psdependoptions, or return a default + # Helper to pick from global PSDependOptions, or return a default function Get-GlobalOption { param( $Options = $PSDependOptions, @@ -158,12 +159,10 @@ $Output = $Default if ($Prefer) { $Output = $Prefer - } - else { + } else { try { $Output = $Options[$Name] - } - catch { + } catch { $Output = $Default } } @@ -179,7 +178,7 @@ } function Inject-Variable { - [cmdletbinding()] + [CmdletBinding()] param( $Value ) $Output = $Value switch ($Value) { @@ -214,14 +213,14 @@ # Helper to take in a dependency hash and output Dependency objects function Parse-Dependency { - [cmdletbinding()] + [CmdletBinding()] param( $ParamSet = $PSCmdlet.ParameterSetName ) # Global settings.... $PSDependOptions = $null - if ($Dependencies.Containskey('PSDependOptions')) { + if ($Dependencies.ContainsKey('PSDependOptions')) { $PSDependOptions = $Dependencies.PSDependOptions $Dependencies.Remove('PSDependOptions') } @@ -261,7 +260,7 @@ elseif ( $DependencyHash -is [string] -and $Dependency -notmatch '/' -and (-not $DependencyType -or - $DependencyType -eq 'PSGalleryModule')) { + $DependencyType -eq 'PSGalleryModule')) { [PSCustomObject]@{ PSTypeName = 'PSDepend.Dependency' DependencyFile = $DependencyFile @@ -287,7 +286,7 @@ $Dependency -match '/' -and $Dependency.split('/').count -eq 2 -and (-not $DependencyType -or - $DependencyType -eq 'GitHub')) { + $DependencyType -eq 'GitHub')) { [PSCustomObject]@{ PSTypeName = 'PSDepend.Dependency' DependencyFile = $DependencyFile @@ -311,7 +310,7 @@ elseif ($DependencyHash -is [string] -and $Dependency -match '/' -and (-not $DependencyType -or - $DependencyType -eq 'Git')) { + $DependencyType -eq 'Git')) { [PSCustomObject]@{ PSTypeName = 'PSDepend.Dependency' DependencyFile = $DependencyFile @@ -330,8 +329,7 @@ PSDependOptions = $PSDependOptions Raw = $null } - } - else { + } else { # Parse dependency hash format # Default type is module, unless it's in a git-style format if (-not $DependencyHash.DependencyType) { @@ -342,10 +340,10 @@ elseif ( # Ugly right? Watch out for split called on hashtable... ($Dependency -match '/' -and -not $Dependency.Name -and - ($Dependency -is [string] -and $Dependency.split('/').count -eq 2) + ($Dependency -is [string] -and $Dependency.split('/').count -eq 2) ) -or ($DependencyHash.Name -match '/' -and - ($DependencyHash -is [string] -and $DependencyHash.split('/').count -eq 2) + ($DependencyHash -is [string] -and $DependencyHash.split('/').count -eq 2) ) ) { $DependencyType = 'GitHub' @@ -356,13 +354,11 @@ $DependencyHash.Name -match '/' ) { $DependencyType = 'Git' - } - else { + } else { # finally, psgallerymodule $DependencyType = 'PSGalleryModule' } - } - else { + } else { $DependencyType = $DependencyHash.DependencyType } @@ -402,8 +398,7 @@ if ($Credentials.ContainsKey($Name)) { $credential = $Credentials[$Name] - } - else { + } else { Write-Warning "No credential found for the specified name $Name. Was the dependency misconfigured?" } } @@ -418,8 +413,7 @@ if (Test-Path $DependencyPath -PathType Container) { $DependencyFiles = @( Resolve-DependScripts -Path $DependencyPath -Recurse $Recurse ) - } - else { + } else { $DependencyFiles = @( $DependencyPath ) } $DependencyFiles = $DependencyFiles | Select-Object -Unique @@ -433,8 +427,7 @@ Parse-Dependency -ParamSet $PSCmdlet.ParameterSetName } } - } - elseif ($PSCmdlet.ParameterSetName -eq 'Hashtable') { + } elseif ($PSCmdlet.ParameterSetName -eq 'Hashtable') { $DependencyFile = 'Hashtable' $ParsedDependencies = foreach ($InputDependency in $InputObject) { $Dependencies = $InputDependency.Clone() diff --git a/PSDepend/Public/Get-PSDependScript.ps1 b/PSDepend/Public/Get-PSDependScript.ps1 index 0b061c4..70891c7 100644 --- a/PSDepend/Public/Get-PSDependScript.ps1 +++ b/PSDepend/Public/Get-PSDependScript.ps1 @@ -28,7 +28,7 @@ .LINK https://github.com/PowerShellOrg/PSDepend #> - [cmdletbinding()] + [CmdletBinding()] [OutputType([hashtable])] param( [validatescript( { Test-Path $_ -PathType Leaf -ErrorAction Stop })] diff --git a/PSDepend/Public/Get-PSDependType.ps1 b/PSDepend/Public/Get-PSDependType.ps1 index 14db37c..bbd790c 100644 --- a/PSDepend/Public/Get-PSDependType.ps1 +++ b/PSDepend/Public/Get-PSDependType.ps1 @@ -1,4 +1,4 @@ -Function Get-PSDependType { +function Get-PSDependType { <# .SYNOPSIS Get dependency types and related information @@ -25,7 +25,7 @@ Show help content for specified dependency types .PARAMETER SkipHelp - Skip retreieving help. Mainly for internl use when it is not required + Skip retrieving help. Mainly for internal use when it is not required .EXAMPLE Get-PSDependType -DependencyType PSGalleryModule -ShowHelp @@ -45,7 +45,7 @@ .LINK https://github.com/PowerShellOrg/PSDepend #> - [cmdletbinding()] + [CmdletBinding()] param( [string]$DependencyType = '*', [validatescript( { Test-Path $_ -PathType Leaf -ErrorAction Stop })] diff --git a/PSDepend/Public/Import-Dependency.ps1 b/PSDepend/Public/Import-Dependency.ps1 index 129ba51..0414435 100644 --- a/PSDepend/Public/Import-Dependency.ps1 +++ b/PSDepend/Public/Import-Dependency.ps1 @@ -1,4 +1,4 @@ -Function Import-Dependency { +function Import-Dependency { <# .SYNOPSIS Import a specific dependency @@ -32,13 +32,13 @@ .LINK https://github.com/PowerShellOrg/PSDepend #> - [cmdletbinding()] + [CmdletBinding()] Param( [parameter( ValueFromPipeline = $True, ParameterSetName = 'Map', Mandatory = $True)] [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [validatescript( { Test-Path -Path $_ -PathType Leaf -ErrorAction Stop })] [string]$PSDependTypePath = $(Join-Path $ModuleRoot PSDependMap.psd1), diff --git a/PSDepend/Public/Install-Dependency.ps1 b/PSDepend/Public/Install-Dependency.ps1 index e07c01e..37c7668 100644 --- a/PSDepend/Public/Install-Dependency.ps1 +++ b/PSDepend/Public/Install-Dependency.ps1 @@ -1,4 +1,4 @@ -Function Install-Dependency { +function Install-Dependency { <# .SYNOPSIS Install a specific dependency @@ -35,13 +35,13 @@ .LINK https://github.com/PowerShellOrg/PSDepend #> - [cmdletbinding( SupportsShouldProcess = $True, + [CmdletBinding( SupportsShouldProcess = $True, ConfirmImpact = 'High' )] Param( [parameter( ValueFromPipeline = $True, Mandatory = $True)] [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [validatescript( { Test-Path -Path $_ -PathType Leaf -ErrorAction Stop })] [string]$PSDependTypePath = $(Join-Path $ModuleRoot PSDependMap.psd1), diff --git a/PSDepend/Public/Invoke-DependencyScript.ps1 b/PSDepend/Public/Invoke-DependencyScript.ps1 index c9a9245..18afa68 100644 --- a/PSDepend/Public/Invoke-DependencyScript.ps1 +++ b/PSDepend/Public/Invoke-DependencyScript.ps1 @@ -35,13 +35,13 @@ .LINK https://github.com/PowerShellOrg/PSDepend #> - [cmdletbinding()] + [CmdletBinding()] param( [parameter( ValueFromPipeline = $True, ParameterSetName = 'Map', Mandatory = $True)] [PSTypeName('PSDepend.Dependency')] - [psobject]$Dependency, + [PSObject]$Dependency, [validatescript( { Test-Path -Path $_ -PathType Leaf -ErrorAction Stop })] [string]$PSDependTypePath = $(Join-Path $ModuleRoot PSDependMap.psd1), @@ -64,7 +64,7 @@ $DependencyDefs = Get-PSDependScript $TheseDependencyTypes = @( $Dependency.DependencyType | Sort-Object -Unique ) - #Build up hash, we call each dependencytype script for applicable dependencies + #Build up hash, we call each DependencyType script for applicable dependencies foreach ($DependencyType in $TheseDependencyTypes) { $PSDependType = ($PSDependTypes | Where-Object { $_.DependencyType -eq $DependencyType }) if (-not $PSDependType.Supported) { @@ -94,8 +94,7 @@ [string[]]$PSDependActions = foreach ($Action in $PSDependAction) { if ($ValidPSDependActions -contains $Action) { $Action - } - else { + } else { Write-Warning "Skipping PSDependAction [$Action] for dependency [$($Dependency.DependencyName)]. Valid actions: [$ValidPSDependActions]" } } @@ -117,8 +116,7 @@ foreach ($key in $ThisDependency.Parameters.keys) { if ($ValidParamNames -contains $key) { $splat.Add($key, $ThisDependency.Parameters.$key) - } - else { + } else { Write-Warning "Parameter [$Key] with value [$($ThisDependency.Parameters.$Key)] is not a valid parameter for [$DependencyType], ignoring. Valid params:`n[$ValidParamNames]" } } @@ -130,12 +128,10 @@ if ($splat.ContainsKey('PSDependAction')) { $Splat['PSDependAction'] = $PSDependActions - } - else { + } else { $Splat.add('PSDependAction', $PSDependActions) } - } - else { + } else { $splat = @{PSDependAction = $PSDependActions } } @@ -147,19 +143,16 @@ foreach ($TaskScript in $ThisDependency.Target) { if ( Test-Path $TaskScript -PathType Leaf) { . $TaskScript @splat - } - else { + } else { Write-Error "Could not process task [$TaskScript].`nAre connectivity, privileges, and other needs met to access it?" } } - } - else { + } else { Write-Verbose "Invoking '$DependencyScript' with parameters $($Splat | Out-String)" $Output = . $DependencyScript @splat if ($PSDependActions -contains 'Test' -and -not $Quiet) { Add-Member -InputObject $ThisDependency -MemberType NoteProperty -Name DependencyExists -Value $Output -Force -PassThru - } - else { + } else { $Output } } diff --git a/PSDepend/Public/Invoke-PSDepend.ps1 b/PSDepend/Public/Invoke-PSDepend.ps1 index ad306f0..1e2feeb 100644 --- a/PSDepend/Public/Invoke-PSDepend.ps1 +++ b/PSDepend/Public/Invoke-PSDepend.ps1 @@ -1,4 +1,5 @@ -Function Invoke-PSDepend { +# cspell:ignore installimport subfolders +function Invoke-PSDepend { <# .SYNOPSIS Invoke PSDepend @@ -77,7 +78,7 @@ -Credentials @{ PrivatePackage = $privateCredentials - AnotherPrivatePackage = $morePrivateCredenials + AnotherPrivatePackage = $morePrivateCredentials } .EXAMPLE @@ -98,7 +99,7 @@ .LINK https://github.com/PowerShellOrg/PSDepend #> - [cmdletbinding( DefaultParameterSetName = 'installimport-file', + [CmdletBinding( DefaultParameterSetName = 'installimport-file', SupportsShouldProcess = $True, ConfirmImpact = 'High' )] [OutputType([string], [bool])] diff --git a/PSDepend/Public/Test-Dependency.ps1 b/PSDepend/Public/Test-Dependency.ps1 index f39e115..4dbcc2d 100644 --- a/PSDepend/Public/Test-Dependency.ps1 +++ b/PSDepend/Public/Test-Dependency.ps1 @@ -36,13 +36,13 @@ .LINK https://github.com/PowerShellOrg/PSDepend #> - [cmdletbinding()] + [CmdletBinding()] param( [parameter( ValueFromPipeline = $True, ParameterSetName = 'Map', Mandatory = $True)] [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency, + [PSObject[]]$Dependency, [validatescript( { Test-Path -Path $_ -PathType Leaf -ErrorAction Stop })] [string]$PSDependTypePath = $(Join-Path $ModuleRoot PSDependMap.psd1), diff --git a/PSDepend/en-US/about_PSDepend.help.txt b/PSDepend/en-US/about_PSDepend.help.txt index 61b3f70..494ba6a 100644 --- a/PSDepend/en-US/about_PSDepend.help.txt +++ b/PSDepend/en-US/about_PSDepend.help.txt @@ -29,19 +29,19 @@ DETAILED DESCRIPTION Prerequisites ============ - + Each dependency type may have certain prerequisites: * PSGalleryModule: Requires the PowerShellGet module (WMF 5 or a separate install) * PSGalleryNuget: This requires nuget.exe in your path*. We handle this for you: - When you import PSDepend, we... - Look for nuget.exe in your path. + When you import PSDepend, we... + Look for nuget.exe in your path. If we don't find it... Look in the path specified in PSDepend\PSDepend.Config's NugetPath. Default is PSDepend\nuget.exe If we don't find it there, we download to that path If we do find it there, we add the parent container to $ENV:Path * Git: Requires git in your path, or in the file path specified in PSDepend\PSDepend.Config's GitPath * Npm: Requires npm in your path - + Example use (*.PSDepend.ps1) ============================ @@ -58,7 +58,7 @@ DETAILED DESCRIPTION buildhelpers = @{ Target = 'CurrentUser' } - pester = 'latest' + pester = 'latest' psake = '4.6.0' } @@ -100,7 +100,7 @@ DETAILED DESCRIPTION -Repository PSRepository to download from. Defaults to PSGallery - + Required? false Position? 2 Default value PSGallery @@ -136,15 +136,15 @@ DETAILED DESCRIPTION Here's how I implement this: param( [PSTypeName('PSDepend.Dependency')] - [psobject[]]$Dependency + [PSObject[]]$Dependency ... Include a 'PSDependAction' parameter. - + Use ValidateSet to specify whether your type supports Test, Install, Import, or other actions. Include details on how you use Dependency properties in the comment-based help DESCRIPTION field. - + See \\Path\To\PSDepend\PSDependScripts\PSGalleryModule.ps1 DESCRIPTION field for an example Include parameters and comment based help for any parameters you read from the Dependency Parameter property. diff --git a/Tests/Chocolatey.Type.Tests.ps1 b/Tests/Chocolatey.Type.Tests.ps1 index 19e3424..5172891 100644 --- a/Tests/Chocolatey.Type.Tests.ps1 +++ b/Tests/Chocolatey.Type.Tests.ps1 @@ -1,4 +1,5 @@ -#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } +# cspell:ignore feedpass feeduser +#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } BeforeDiscovery { Import-Module (Join-Path $PSScriptRoot 'Shared/TestHelpers.psm1') -Force diff --git a/Tests/DependFiles/git.depend.psd1 b/Tests/DependFiles/git.depend.psd1 index 19bcf11..a9fb97f 100644 --- a/Tests/DependFiles/git.depend.psd1 +++ b/Tests/DependFiles/git.depend.psd1 @@ -1,4 +1,5 @@ -@{ +# cspell:ignore nightroman +@{ 'buildhelpers' = @{ Name = 'https://github.com/RamblingCookieMonster/BuildHelpers.git' Version = 'd32a9495c39046c851ceccfb7b1a85b17d5be051' diff --git a/Tests/FileDownload.Type.Tests.ps1 b/Tests/FileDownload.Type.Tests.ps1 index 3777a54..9316d3f 100644 --- a/Tests/FileDownload.Type.Tests.ps1 +++ b/Tests/FileDownload.Type.Tests.ps1 @@ -1,4 +1,5 @@ -#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } +# cspell:ignore extensionless newcontainer relbase +#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } BeforeDiscovery { Import-Module (Join-Path $PSScriptRoot 'Shared/TestHelpers.psm1') -Force diff --git a/Tests/Git.Type.Tests.ps1 b/Tests/Git.Type.Tests.ps1 index dd4e7e6..b688c11 100644 --- a/Tests/Git.Type.Tests.ps1 +++ b/Tests/Git.Type.Tests.ps1 @@ -1,4 +1,5 @@ -#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } +# cspell:ignore materialising nongit TrimEnd +#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } BeforeAll { if (-not $env:BHProjectPath) { @@ -84,8 +85,12 @@ Describe 'Git script' { InModuleScope PSDepend -Parameters @{ Dep = $dep; ScriptPath = $script:ScriptPath } { # rev-parse returns the branch name matching Version Mock Invoke-ExternalCommand { - if ($Arguments -contains '--abbrev-ref') { return 'main' } - if ($Arguments -notcontains 'clone' -and $Arguments -notcontains '--abbrev-ref') { return 'abc1234' } + if ($Arguments -contains '--abbrev-ref') { + return 'main' + } + if ($Arguments -notcontains 'clone' -and $Arguments -notcontains '--abbrev-ref') { + return 'abc1234' + } } & $ScriptPath -Dependency $Dep } diff --git a/Tests/GitHub.Type.Tests.ps1 b/Tests/GitHub.Type.Tests.ps1 index 3e8731e..ecbc477 100644 --- a/Tests/GitHub.Type.Tests.ps1 +++ b/Tests/GitHub.Type.Tests.ps1 @@ -1,4 +1,5 @@ -#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } +# cspell:ignore somerepo someuser +#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } BeforeAll { if (-not $env:BHProjectPath) { diff --git a/Tests/Help.tests.ps1 b/Tests/Help.tests.ps1 index ea170b0..a9494a5 100644 --- a/Tests/Help.tests.ps1 +++ b/Tests/Help.tests.ps1 @@ -1,4 +1,5 @@ -# Taken with love from @juneb_get_help (https://raw.githubusercontent.com/juneb/PesterTDD/master/Module.Help.Tests.ps1) +# cspell:ignore juneb +# Taken with love from @juneb_get_help (https://raw.githubusercontent.com/juneb/PesterTDD/master/Module.Help.Tests.ps1) BeforeDiscovery { if (-not $env:BHProjectPath) { diff --git a/Tests/Manifest.tests.ps1 b/Tests/Manifest.tests.ps1 index 31db1e8..af7effe 100644 --- a/Tests/Manifest.tests.ps1 +++ b/Tests/Manifest.tests.ps1 @@ -1,4 +1,5 @@ -BeforeAll { +# cspell:ignore oneline +BeforeAll { if (-not $env:BHProjectPath) { & "$PSScriptRoot\..\build.ps1" -Task 'Build' } diff --git a/Tests/MetaFixers.psm1 b/Tests/MetaFixers.psm1 index ceea2a8..c6254a6 100644 --- a/Tests/MetaFixers.psm1 +++ b/Tests/MetaFixers.psm1 @@ -44,12 +44,12 @@ function Get-TextFilesList { ) begin { - $txtFileExtentions = @('.gitignore', '.gitattributes', '.ps1', '.psm1', '.psd1', '.json', '.xml', '.cmd', '.mof') + $txtFileExtensions = @('.gitignore', '.gitattributes', '.ps1', '.psm1', '.psd1', '.json', '.xml', '.cmd', '.mof') } process { Get-ChildItem -Path $Root -File -Recurse | - Where-Object { $_.Extension -in $txtFileExtentions } + Where-Object { $_.Extension -in $txtFileExtensions } } } diff --git a/Tests/Nuget.Type.Tests.ps1 b/Tests/Nuget.Type.Tests.ps1 index c082f4b..1645a3a 100644 --- a/Tests/Nuget.Type.Tests.ps1 +++ b/Tests/Nuget.Type.Tests.ps1 @@ -1,4 +1,5 @@ -#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } +# cspell:ignore Newtonsoft noplatform +#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } BeforeAll { if (-not $env:BHProjectPath) { diff --git a/Tests/PSDepend.Tests.ps1 b/Tests/PSDepend.Tests.ps1 index 4bf53cd..6fc4443 100644 --- a/Tests/PSDepend.Tests.ps1 +++ b/Tests/PSDepend.Tests.ps1 @@ -1,4 +1,5 @@ -BeforeDiscovery { +# cspell:ignore allprops multiplepsgallerymodule nonexistenttag +BeforeDiscovery { if ($null -eq $env:BHPSModuleManifest) { & "$PSScriptRoot/../Build.ps1" -Task Init } @@ -78,6 +79,7 @@ Describe "Get-Dependency PS$PSVersion" -Tag 'Unit' { } It 'Should handle DependsOn' { + # cspell:disable-next-line $Dependencies = Get-Dependency -Path $TestDepends\dependson.depend.psd1 @( $Dependencies ).count | Should -Be 3 $Dependencies[0].DependencyName | Should -Be 'One' @@ -137,7 +139,7 @@ Describe "Get-Dependency PS$PSVersion" -Tag 'Unit' { $deps2 = Get-Dependency -InputObject $inputObj $inputObj.ContainsKey('PSDependOptions') | Should -Be $True $inputObj.PSDependOptions.Target | Should -Be 'CurrentUser' - ($deps2 | Where-Object DependencyName -eq 'Pester').Target | Should -Be 'CurrentUser' + ($deps2 | Where-Object DependencyName -EQ 'Pester').Target | Should -Be 'CurrentUser' } It 'Parses -InputObject hashtable as PSGalleryModule by default' { diff --git a/Tests/PSGalleryNuget.Type.Tests.ps1 b/Tests/PSGalleryNuget.Type.Tests.ps1 index 5ed9044..c970c9e 100644 --- a/Tests/PSGalleryNuget.Type.Tests.ps1 +++ b/Tests/PSGalleryNuget.Type.Tests.ps1 @@ -1,4 +1,5 @@ -#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } +# cspell:ignore noplatform psgnuget +#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } BeforeAll { if (-not $env:BHProjectPath) { diff --git a/Tests/PSModuleGallery.Type.Tests.ps1 b/Tests/PSModuleGallery.Type.Tests.ps1 index 391d378..43b845c 100644 --- a/Tests/PSModuleGallery.Type.Tests.ps1 +++ b/Tests/PSModuleGallery.Type.Tests.ps1 @@ -1,4 +1,5 @@ -BeforeDiscovery { +# cspell:ignore dummysource latestaddtopath latestversion latestversionrequested missingrepo multiplecredentials nightroman sameversion savemodule skippubcheck specificversionrequested withcredentials xcopy +BeforeDiscovery { if ($null -eq $env:BHPSModuleManifest) { & "$PSScriptRoot/../Build.ps1" -Task Init } @@ -519,7 +520,7 @@ Describe "PSModuleGallery Type" -Tag 'Integration' { Mock Pop-Location {} -ModuleName PSDepend Mock Set-Location {} -ModuleName PSDepend Mock Test-Path { return $False } -ModuleName PSDepend -ParameterFilter { $Path -match 'buildhelpers' } - Mock New-Item { [pscustomobject]@{ FullName = $Path } } -ModuleName PSDepend + Mock New-Item { [PSCustomObject]@{ FullName = $Path } } -ModuleName PSDepend $null = Invoke-PSDepend @Verbose -Path "$TestDepends\git.depend.psd1" -Force } @@ -901,10 +902,18 @@ Describe "PSModuleGallery Type" -Tag 'Integration' { # NOTE: 'script:' qualifier is required — without it, the function is created # in a temporary scope that vanishes when the scriptblock returns. & (Get-Module PSDepend) { - function script:Get-Package { [cmdletbinding()]param($ProviderName, $Name, $RequiredVersion) } - function script:Install-Package { [cmdletbinding()]param($Source, $Name, $RequiredVersion, $Force) } - function script:Find-Package { [cmdletbinding()]param($Name, $Source) } - function script:Get-PackageSource { [cmdletbinding()]param() } + function script:Get-Package { + [CmdletBinding()]param($ProviderName, $Name, $RequiredVersion) + } + function script:Install-Package { + [CmdletBinding()]param($Source, $Name, $RequiredVersion, $Force) + } + function script:Find-Package { + [CmdletBinding()]param($Name, $Source) + } + function script:Get-PackageSource { + [CmdletBinding()]param() + } } } @@ -1151,14 +1160,12 @@ Describe "PSModuleGallery Type" -Tag 'Integration' { $script:IsWindowsEnv = !$PSVersionTable.Platform -or $PSVersionTable.Platform -eq "Win32NT" $script:GlobalDotnetSdkLocation = if ($script:IsWindowsEnv) { "$env:LocalAppData\Microsoft\dotnet" - } - else { + } else { "$env:HOME/.dotnet" } $script:DotnetFile = if ($script:IsWindowsEnv) { "dotnet.exe" - } - else { + } else { "dotnet" } $script:SavePath = '.dotnet' @@ -1207,7 +1214,7 @@ Describe "PSModuleGallery Type" -Tag 'Integration' { Mock Get-DotnetVersion { return '2.1.330-rc1' } -ModuleName PSDepend } - It 'Can propertly compare semantic versions' { + It 'Can properly compare semantic versions' { # '2.1.330-rc1' >= '2.1.330-preview1' # '2.1.330-rc1' >= '2.1.330-rc1' # '2.1.330-rc1' >= '1.0' diff --git a/Tests/Package.Type.Tests.ps1 b/Tests/Package.Type.Tests.ps1 index c5a0e21..ce21767 100644 --- a/Tests/Package.Type.Tests.ps1 +++ b/Tests/Package.Type.Tests.ps1 @@ -1,4 +1,5 @@ -#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } +# cspell:ignore jquery +#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } BeforeAll { if (-not $env:BHProjectPath) { diff --git a/Tests/Task.Type.Tests.ps1 b/Tests/Task.Type.Tests.ps1 index 4ae408c..04437c3 100644 --- a/Tests/Task.Type.Tests.ps1 +++ b/Tests/Task.Type.Tests.ps1 @@ -1,4 +1,5 @@ -#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } +# cspell:ignore taskflag taskparam +#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } BeforeAll { if (-not $env:BHProjectPath) { diff --git a/Tests/Test-VersionEquality.Tests.ps1 b/Tests/Test-VersionEquality.Tests.ps1 index a532145..6747bc9 100644 --- a/Tests/Test-VersionEquality.Tests.ps1 +++ b/Tests/Test-VersionEquality.Tests.ps1 @@ -1,4 +1,5 @@ -#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } +# cspell:ignore normalisation normalises +#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } BeforeAll { if (-not $env:BHProjectPath) { diff --git a/Tests/WindowsRSAT.Type.Tests.ps1 b/Tests/WindowsRSAT.Type.Tests.ps1 index 177d0d9..cf1d573 100644 --- a/Tests/WindowsRSAT.Type.Tests.ps1 +++ b/Tests/WindowsRSAT.Type.Tests.ps1 @@ -1,4 +1,5 @@ -#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } +# cspell:ignore ADRMS CDXML DISM GPMC RSAT +#requires -Module @{ ModuleName = 'Pester'; ModuleVersion = '5.0.0' } BeforeDiscovery { Import-Module (Join-Path $PSScriptRoot 'Shared/TestHelpers.psm1') -Force diff --git a/cspell.json b/cspell.json index 2b0e774..7f2ff3b 100644 --- a/cspell.json +++ b/cspell.json @@ -1,4 +1,5 @@ { + "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/packages/cspell-types/cspell.schema.json", "version": "0.2", "ignorePaths": [], "dictionaryDefinitions": [], @@ -6,10 +7,37 @@ "powershell" ], "words": [ + "BHPS", + "RSAT", "choco", - "lessmsi", - "psake" + "psake", + "nuget", + "PSDepend" + ], + "ignoreWords": [ + "Creds", + "ContainsKey", + "Padgett", + "PSGALLERY", + "TARGETDIR", + "addtopath", + "buildhelpers", + "dotnetsdk", + "gitbook", + "islatest", + "packagesource", + "proga", + "psdependoptions", + "psdeploy", + "psgallerymodule", + "psgallerynuget", + "psresourceget", + "providername", + "ramblingcookiemonster", + "semanticversion", + "validateset", + "validatescript", + "whatif" ], - "ignoreWords": [], "import": [] } diff --git a/docs/PSDependScripts-ReviewerChecklist.md b/docs/PSDependScripts-ReviewerChecklist.md index e0fe8b3..5a1b6e7 100644 --- a/docs/PSDependScripts-ReviewerChecklist.md +++ b/docs/PSDependScripts-ReviewerChecklist.md @@ -8,7 +8,7 @@ Each script implements a single `DependencyType` (e.g. `PSGalleryModule`, `Git`, ### 1. Standard parameter contract -- First parameter is `[PSTypeName('PSDepend.Dependency')][psobject[]]$Dependency`. +- First parameter is `[PSTypeName('PSDepend.Dependency')][PSObject[]]$Dependency`. - `$PSDependAction` is `[ValidateSet(...)][string[]]` with **only** the actions the script actually implements (`Test`, `Install`, `Import`) and defaults to `@('Install')`. @@ -119,7 +119,7 @@ Use this as a PR review checklist when adding or modifying a script under ### Contract -- [ ] First param is `[PSTypeName('PSDepend.Dependency')][psobject[]]$Dependency`. +- [ ] First param is `[PSTypeName('PSDepend.Dependency')][PSObject[]]$Dependency`. - [ ] `PSDependAction` is `[ValidateSet(...)]` and lists only implemented actions. - [ ] Type-specific params are top-level (not buried in `$Dependency.Parameters` lookups inside the body). diff --git a/docs/en-US/Invoke-PSDepend.md b/docs/en-US/Invoke-PSDepend.md index f64b019..a2eff48 100644 --- a/docs/en-US/Invoke-PSDepend.md +++ b/docs/en-US/Invoke-PSDepend.md @@ -5,6 +5,8 @@ online version: https://github.com/PowerShellOrg/PSDepend schema: 2.0.0 --- + + # Invoke-PSDepend ## SYNOPSIS diff --git a/static/README.md b/static/README.md index b3237e4..e75df89 100644 --- a/static/README.md +++ b/static/README.md @@ -1,5 +1,7 @@ # Logos + + These logos are from https://www.flaticon.com/free-icon/checklist_9752284?term=package&page=1&position=13&origin=search&related_id=9752284