diff --git a/PSQualityCheck.Functions.psd1 b/PSQualityCheck.Functions.psd1 index 4e5a3f2..2820952 100644 --- a/PSQualityCheck.Functions.psd1 +++ b/PSQualityCheck.Functions.psd1 @@ -12,7 +12,7 @@ RootModule = 'PSQualityCheck.Functions.psm1' # Version number of this module. -ModuleVersion = '1.0.8' +ModuleVersion = '1.0.9' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PSQualityCheck.Functions.psm1 b/PSQualityCheck.Functions.psm1 index ce03e61..e6c59ab 100644 --- a/PSQualityCheck.Functions.psm1 +++ b/PSQualityCheck.Functions.psm1 @@ -161,7 +161,7 @@ function Export-FunctionsFromModule { A string Path containing the full path to the extraction folder .EXAMPLE - Export-FunctionsFromModule -Path 'c:\path.to\module.psm1' -FunctionExtractionPath 'c:\extract' + Export-FunctionsFromModule -Path 'c:\path.to\module.psm1' -FunctionExtractPath 'c:\extract' #> [CmdletBinding()] [OutputType([System.Void])] @@ -346,7 +346,7 @@ function Get-FileList { $files = Get-FileList -Path 'c:\folder' -Extension ".ps1" #> [CmdletBinding()] - [OutputType([System.String[]])] + [OutputType([System.Object[]])] param ( [parameter(Mandatory = $true)] [string]$Path, @@ -387,7 +387,7 @@ function Get-FunctionCount { A string containing the Manifest filename .EXAMPLE - ($ExportedCommandsCount, $CommandFoundInModuleCount, $CommandInModuleCount, $CommandFoundInManifestCount) = Get-FunctionCount -Module $moduleFile -Manifest $manifestFile + ($ExportedCommandsCount, $CommandFoundInModuleCount, $CommandInModuleCount, $CommandFoundInManifestCount) = Get-FunctionCount -ModuleFile $moduleFile -ManifestFile $manifestFile #> [CmdletBinding()] @@ -401,7 +401,8 @@ function Get-FunctionCount { try { if (Test-Path -Path $ManifestFile) { - $ExportedCommandsCount = (Test-ModuleManifest -Path $ManifestFile).ExportedCommands.Count + $ExportedCommands = (Test-ModuleManifest -Path $ManifestFile -ErrorAction Stop).ExportedCommands + $ExportedCommandsCount = $ExportedCommands.Count } else { throw "Manifest file doesn't exist" @@ -411,6 +412,7 @@ function Get-FunctionCount { $ExportedCommands = @() $ExportedCommandsCount = 0 } + try { if (Test-Path -Path $ModuleFile) { ($ParsedModule, $ParserErrors) = Get-ParsedFile -Path $ModuleFile @@ -453,10 +455,10 @@ function Get-FunctionCount { if ($ExportedCommandsCount -ge 1) { - $functionNames | ForEach-Object { + foreach ($function in $functionNames) { $CommandInModuleCount++ - if ($ExportedCommands.ContainsKey($_.Content)) { + if ($ExportedCommands.ContainsKey($function.Content)) { $CommandFoundInManifestCount++ @@ -746,7 +748,7 @@ function Test-HelpForRequiredTokens { A string containing the text of the Help Comment .EXAMPLE - Test-HelpForRequiredTokens -HelpComment $helpComment + Test-HelpForRequiredTokens -HelpTokens $HelpTokens #> [CmdletBinding()] [OutputType([System.Exception], [System.Void])] @@ -813,7 +815,7 @@ function Test-HelpForUnspecifiedTokens { A string containing the text of the Help Comment .EXAMPLE - Test-HelpForUnspecifiedTokens -HelpComment $helpComment + Test-HelpForUnspecifiedTokens -HelpTokens $HelpTokens #> [CmdletBinding()] [OutputType([System.Exception], [System.Void])] @@ -885,7 +887,7 @@ function Test-HelpTokensCountIsValid { A string containing the text of the Help Comment .EXAMPLE - Test-HelpTokensCountIsValid -HelpComment $helpComment + Test-HelpTokensCountIsValid -HelpTokens $HelpTokens .NOTES This function will only check the Min/Max counts of required help tokens @@ -980,7 +982,7 @@ function Test-HelpTokensParamsMatch { A object containing the parameters from the param block .EXAMPLE - Test-HelpTokensParamsMatch -HelpComment $helpComment -ParameterVariables $ParameterVariables + Test-HelpTokensParamsMatch -HelpTokens $HelpTokens -ParameterVariables $ParameterVariables #> [CmdletBinding()] [OutputType([System.Exception], [System.String[]])] @@ -1074,7 +1076,7 @@ function Test-HelpTokensTextIsValid { A string containing the text of the Help Comment .EXAMPLE - Test-HelpTokensTextIsValid -HelpComment $helpComment + Test-HelpTokensTextIsValid -HelpTokens $HelpTokens #> [CmdletBinding()] [OutputType([System.Exception], [System.Void])] @@ -1134,7 +1136,7 @@ function Test-ImportModuleIsValid { An object containing the Import-Module calls found .EXAMPLE - TestImportModuleIsValid -ParsedFile $parsedFile + TestImportModuleIsValid -ParsedFile $parsedFile -ImportModuleTokens $importModuleTokens #> [CmdletBinding()] [OutputType([System.Exception], [System.Void])] diff --git a/PSQualityCheck.psd1 b/PSQualityCheck.psd1 index b773612..cc879d4 100644 --- a/PSQualityCheck.psd1 +++ b/PSQualityCheck.psd1 @@ -12,7 +12,7 @@ RootModule = 'PSQualityCheck.psm1' # Version number of this module. -ModuleVersion = '1.0.8' +ModuleVersion = '1.0.9' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/Source/Build.Properties.json b/Source/Build.Properties.json index 0ec6541..cbcf319 100644 --- a/Source/Build.Properties.json +++ b/Source/Build.Properties.json @@ -18,7 +18,7 @@ }, "HelpInfoURI": "https://github.com/andrewrdavidson/PSQualityCheck/wiki", "LicenseUri": "https://github.com/andrewrdavidson/PSQualityCheck/blob/main/LICENSE", - "ModuleVersion": "1.0.8", + "ModuleVersion": "1.0.9", "NestedModules": { "PSQualityCheck": "PSQualityCheck.Functions.psd1", "PSQualityCheck.Functions": null diff --git a/Source/Invoke-Build.ps1 b/Source/Invoke-Build.ps1 index 4ac062d..ec7ca1a 100644 --- a/Source/Invoke-Build.ps1 +++ b/Source/Invoke-Build.ps1 @@ -1,3 +1,13 @@ +<# + .SYNOPSIS + Build the PSQualityCheck modules + + .DESCRIPTION + Builds the PSQualityCheck and PSQualityCheck.Functions modules and generates new manifest files + + .EXAMPLE + Invoke-Build.ps1 +#> [CmdletBinding()] [OutputType([System.Void])] param ( @@ -83,7 +93,6 @@ foreach ($folder in $sourceScriptFolders) { NestedModules = $buildProperties.NestedModules.($folder.Name) - } New-ModuleManifest @newModuleManifest diff --git a/Source/PSQualityCheck.Functions/Export-FunctionsFromModule.ps1 b/Source/PSQualityCheck.Functions/Export-FunctionsFromModule.ps1 index 84365bc..956395c 100644 --- a/Source/PSQualityCheck.Functions/Export-FunctionsFromModule.ps1 +++ b/Source/PSQualityCheck.Functions/Export-FunctionsFromModule.ps1 @@ -13,7 +13,7 @@ function Export-FunctionsFromModule { A string Path containing the full path to the extraction folder .EXAMPLE - Export-FunctionsFromModule -Path 'c:\path.to\module.psm1' -FunctionExtractionPath 'c:\extract' + Export-FunctionsFromModule -Path 'c:\path.to\module.psm1' -FunctionExtractPath 'c:\extract' #> [CmdletBinding()] [OutputType([System.Void])] diff --git a/Source/PSQualityCheck.Functions/Get-FileList.ps1 b/Source/PSQualityCheck.Functions/Get-FileList.ps1 index 83c9311..d1e89e1 100644 --- a/Source/PSQualityCheck.Functions/Get-FileList.ps1 +++ b/Source/PSQualityCheck.Functions/Get-FileList.ps1 @@ -16,7 +16,7 @@ function Get-FileList { $files = Get-FileList -Path 'c:\folder' -Extension ".ps1" #> [CmdletBinding()] - [OutputType([System.String[]])] + [OutputType([System.Object[]])] param ( [parameter(Mandatory = $true)] [string]$Path, diff --git a/Source/PSQualityCheck.Functions/Get-FunctionCount.ps1 b/Source/PSQualityCheck.Functions/Get-FunctionCount.ps1 index 095b5f9..5e7c736 100644 --- a/Source/PSQualityCheck.Functions/Get-FunctionCount.ps1 +++ b/Source/PSQualityCheck.Functions/Get-FunctionCount.ps1 @@ -14,7 +14,7 @@ function Get-FunctionCount { A string containing the Manifest filename .EXAMPLE - ($ExportedCommandsCount, $CommandFoundInModuleCount, $CommandInModuleCount, $CommandFoundInManifestCount) = Get-FunctionCount -Module $moduleFile -Manifest $manifestFile + ($ExportedCommandsCount, $CommandFoundInModuleCount, $CommandInModuleCount, $CommandFoundInManifestCount) = Get-FunctionCount -ModuleFile $moduleFile -ManifestFile $manifestFile #> [CmdletBinding()] @@ -28,7 +28,8 @@ function Get-FunctionCount { try { if (Test-Path -Path $ManifestFile) { - $ExportedCommandsCount = (Test-ModuleManifest -Path $ManifestFile).ExportedCommands.Count + $ExportedCommands = (Test-ModuleManifest -Path $ManifestFile -ErrorAction Stop).ExportedCommands + $ExportedCommandsCount = $ExportedCommands.Count } else { throw "Manifest file doesn't exist" @@ -38,6 +39,7 @@ function Get-FunctionCount { $ExportedCommands = @() $ExportedCommandsCount = 0 } + try { if (Test-Path -Path $ModuleFile) { ($ParsedModule, $ParserErrors) = Get-ParsedFile -Path $ModuleFile @@ -80,10 +82,10 @@ function Get-FunctionCount { if ($ExportedCommandsCount -ge 1) { - $functionNames | ForEach-Object { + foreach ($function in $functionNames) { $CommandInModuleCount++ - if ($ExportedCommands.ContainsKey($_.Content)) { + if ($ExportedCommands.ContainsKey($function.Content)) { $CommandFoundInManifestCount++ diff --git a/Source/PSQualityCheck.Functions/Test-HelpForRequiredTokens.ps1 b/Source/PSQualityCheck.Functions/Test-HelpForRequiredTokens.ps1 index 131d8f4..684a7fe 100644 --- a/Source/PSQualityCheck.Functions/Test-HelpForRequiredTokens.ps1 +++ b/Source/PSQualityCheck.Functions/Test-HelpForRequiredTokens.ps1 @@ -10,7 +10,7 @@ function Test-HelpForRequiredTokens { A string containing the text of the Help Comment .EXAMPLE - Test-HelpForRequiredTokens -HelpComment $helpComment + Test-HelpForRequiredTokens -HelpTokens $HelpTokens #> [CmdletBinding()] [OutputType([System.Exception], [System.Void])] diff --git a/Source/PSQualityCheck.Functions/Test-HelpForUnspecifiedTokens.ps1 b/Source/PSQualityCheck.Functions/Test-HelpForUnspecifiedTokens.ps1 index 34f2fb6..262b741 100644 --- a/Source/PSQualityCheck.Functions/Test-HelpForUnspecifiedTokens.ps1 +++ b/Source/PSQualityCheck.Functions/Test-HelpForUnspecifiedTokens.ps1 @@ -10,7 +10,7 @@ function Test-HelpForUnspecifiedTokens { A string containing the text of the Help Comment .EXAMPLE - Test-HelpForUnspecifiedTokens -HelpComment $helpComment + Test-HelpForUnspecifiedTokens -HelpTokens $HelpTokens #> [CmdletBinding()] [OutputType([System.Exception], [System.Void])] diff --git a/Source/PSQualityCheck.Functions/Test-HelpTokensCountIsValid.ps1 b/Source/PSQualityCheck.Functions/Test-HelpTokensCountIsValid.ps1 index e117540..c21ef2a 100644 --- a/Source/PSQualityCheck.Functions/Test-HelpTokensCountIsValid.ps1 +++ b/Source/PSQualityCheck.Functions/Test-HelpTokensCountIsValid.ps1 @@ -10,7 +10,7 @@ function Test-HelpTokensCountIsValid { A string containing the text of the Help Comment .EXAMPLE - Test-HelpTokensCountIsValid -HelpComment $helpComment + Test-HelpTokensCountIsValid -HelpTokens $HelpTokens .NOTES This function will only check the Min/Max counts of required help tokens diff --git a/Source/PSQualityCheck.Functions/Test-HelpTokensParamsMatch.ps1 b/Source/PSQualityCheck.Functions/Test-HelpTokensParamsMatch.ps1 index 2f8d0ef..8cf8457 100644 --- a/Source/PSQualityCheck.Functions/Test-HelpTokensParamsMatch.ps1 +++ b/Source/PSQualityCheck.Functions/Test-HelpTokensParamsMatch.ps1 @@ -13,7 +13,7 @@ function Test-HelpTokensParamsMatch { A object containing the parameters from the param block .EXAMPLE - Test-HelpTokensParamsMatch -HelpComment $helpComment -ParameterVariables $ParameterVariables + Test-HelpTokensParamsMatch -HelpTokens $HelpTokens -ParameterVariables $ParameterVariables #> [CmdletBinding()] [OutputType([System.Exception], [System.String[]])] diff --git a/Source/PSQualityCheck.Functions/Test-HelpTokensTextIsValid.ps1 b/Source/PSQualityCheck.Functions/Test-HelpTokensTextIsValid.ps1 index d45552d..2d637ab 100644 --- a/Source/PSQualityCheck.Functions/Test-HelpTokensTextIsValid.ps1 +++ b/Source/PSQualityCheck.Functions/Test-HelpTokensTextIsValid.ps1 @@ -10,7 +10,7 @@ function Test-HelpTokensTextIsValid { A string containing the text of the Help Comment .EXAMPLE - Test-HelpTokensTextIsValid -HelpComment $helpComment + Test-HelpTokensTextIsValid -HelpTokens $HelpTokens #> [CmdletBinding()] [OutputType([System.Exception], [System.Void])] diff --git a/Source/PSQualityCheck.Functions/Test-ImportModuleIsValid.ps1 b/Source/PSQualityCheck.Functions/Test-ImportModuleIsValid.ps1 index 74cc9b0..2313414 100644 --- a/Source/PSQualityCheck.Functions/Test-ImportModuleIsValid.ps1 +++ b/Source/PSQualityCheck.Functions/Test-ImportModuleIsValid.ps1 @@ -13,7 +13,7 @@ function Test-ImportModuleIsValid { An object containing the Import-Module calls found .EXAMPLE - TestImportModuleIsValid -ParsedFile $parsedFile + TestImportModuleIsValid -ParsedFile $parsedFile -ImportModuleTokens $importModuleTokens #> [CmdletBinding()] [OutputType([System.Exception], [System.Void])]