From 498b061c4e553ea4ea986835caf312b352e648a5 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 16 Feb 2025 12:00:08 +0100 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20linter?= =?UTF-8?q?=20configurations=20and=20license=20year;=20enhance=20.gitignor?= =?UTF-8?q?e=20for=20VS=20Code=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/linters/.jscpd.json | 10 + .../linters/.powershell-psscriptanalyzer.psd1 | 69 ++- .github/linters/.textlintrc | 513 ++++++++++++++++++ .github/workflows/Linter.yml | 2 +- .gitignore | 11 +- LICENSE | 2 +- 6 files changed, 585 insertions(+), 22 deletions(-) create mode 100644 .github/linters/.jscpd.json create mode 100644 .github/linters/.textlintrc diff --git a/.github/linters/.jscpd.json b/.github/linters/.jscpd.json new file mode 100644 index 00000000..aa95628d --- /dev/null +++ b/.github/linters/.jscpd.json @@ -0,0 +1,10 @@ +{ + "threshold": 0, + "reporters": [ + "consoleFull" + ], + "ignore": [ + "**/tests/*" + ], + "absolute": true +} diff --git a/.github/linters/.powershell-psscriptanalyzer.psd1 b/.github/linters/.powershell-psscriptanalyzer.psd1 index 40d11d60..e9081f9a 100644 --- a/.github/linters/.powershell-psscriptanalyzer.psd1 +++ b/.github/linters/.powershell-psscriptanalyzer.psd1 @@ -1,18 +1,57 @@ -#Documentation: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/Cmdlets/Invoke-ScriptAnalyzer.md#-settings -@{ - #CustomRulePath='path\to\CustomRuleModule.psm1' - #RecurseCustomRulePath='path\of\customrules' - #Severity = @( - # 'Error' - # 'Warning' - #) - #IncludeDefaultRules=${true} +@{ + Rules = @{ + PSAlignAssignmentStatement = @{ + Enable = $true + CheckHashtable = $true + } + PSAvoidLongLines = @{ + Enable = $true + MaximumLineLength = 150 + } + PSAvoidSemicolonsAsLineTerminators = @{ + Enable = $true + } + PSPlaceCloseBrace = @{ + Enable = $true + NewLineAfter = $false + IgnoreOneLineBlock = $true + NoEmptyLineBefore = $false + } + PSPlaceOpenBrace = @{ + Enable = $true + OnSameLine = $true + NewLineAfter = $true + IgnoreOneLineBlock = $true + } + PSProvideCommentHelp = @{ + Enable = $true + ExportedOnly = $false + BlockComment = $true + VSCodeSnippetCorrection = $false + Placement = 'begin' + } + PSUseConsistentIndentation = @{ + Enable = $true + IndentationSize = 4 + PipelineIndentation = 'IncreaseIndentationForFirstPipeline' + Kind = 'space' + } + PSUseConsistentWhitespace = @{ + Enable = $true + CheckInnerBrace = $true + CheckOpenBrace = $true + CheckOpenParen = $true + CheckOperator = $true + CheckPipe = $true + CheckPipeForRedundantWhitespace = $true + CheckSeparator = $true + CheckParameter = $true + IgnoreAssignmentOperatorInsideHashTable = $true + } + } ExcludeRules = @( - 'PSMissingModuleManifestField' - 'PSAvoidUsingWriteHost' + 'PSMissingModuleManifestField', # This rule is not applicable until the module is built. + 'PSAvoidUsingCmdletAliases', + 'PSUseToExportFieldsInManifest' ) - #IncludeRules = @( - # 'PSAvoidUsingWriteHost', - # 'MyCustomRuleName' - #) } diff --git a/.github/linters/.textlintrc b/.github/linters/.textlintrc new file mode 100644 index 00000000..db48de80 --- /dev/null +++ b/.github/linters/.textlintrc @@ -0,0 +1,513 @@ +{ + "filters": { + "comments": true + }, + "rules": { + "terminology": { + "defaultTerms": false, + "terms": [ + "Airbnb", + "Android", + "AppleScript", + "AppVeyor", + "AVA", + "BrowserStack", + "Browsersync", + "Codecov", + "CodePen", + "CodeSandbox", + "DefinitelyTyped", + "EditorConfig", + "ESLint", + "GitHub", + "GraphQL", + "GraphiQL", + "iOS", + "JavaScript", + "JetBrains", + "jQuery", + "LinkedIn", + "Lodash", + "MacBook", + "Markdown", + "OpenType", + "PayPal", + "PhpStorm", + "PowerShell", + "PlayStation", + "RubyMine", + "Sass", + "SemVer", + "TypeScript", + "UglifyJS", + "Wasm", + "WebAssembly", + "WebStorm", + "WordPress", + "YouTube", + [ + "Common[ .]js", + "CommonJS" + ], + [ + "JSDocs?", + "JSDoc" + ], + [ + "Node[ .]js", + "Node.js" + ], + [ + "React[ .]js", + "React" + ], + [ + "SauceLabs", + "Sauce Labs" + ], + [ + "StackOverflow", + "Stack Overflow" + ], + [ + "styled ?components", + "styled-components" + ], + [ + "HTTP[ /]2(?:\\.0)?", + "HTTP/2" + ], + [ + "OS X", + "macOS" + ], + [ + "Mac ?OS", + "macOS" + ], + [ + "a npm", + "an npm" + ], + "ECMAScript", + [ + "ES2015", + "ES6" + ], + [ + "ES7", + "ES2016" + ], + "3D", + [ + "3-D", + "3D" + ], + "Ajax", + "API", + "APIs", + "API's", + [ + "(? Date: Sun, 16 Feb 2025 12:08:37 +0100 Subject: [PATCH 02/10] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20jscpd?= =?UTF-8?q?=20configuration=20to=20ignore=20Action-Test.yml=20in=20workflo?= =?UTF-8?q?ws?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/linters/.jscpd.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/linters/.jscpd.json b/.github/linters/.jscpd.json index aa95628d..91eb2f2d 100644 --- a/.github/linters/.jscpd.json +++ b/.github/linters/.jscpd.json @@ -4,7 +4,8 @@ "consoleFull" ], "ignore": [ - "**/tests/*" + "**/tests/*", + ".github/workflows/Action-Test.yml" ], "absolute": true } From 7e8fe73e53a841fc09ed044fdfb89eac1b66ba61 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 16 Feb 2025 12:20:09 +0100 Subject: [PATCH 03/10] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Remove=20'PSAvo?= =?UTF-8?q?idUsingCmdletAliases'=20from=20ExcludeRules=20in=20PSScriptAnal?= =?UTF-8?q?yzer=20configuration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/linters/.powershell-psscriptanalyzer.psd1 | 1 - scripts/helpers/Build/PSScriptAnalyzer.Tests.psd1 | 1 - scripts/main.ps1 | 8 ++++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/linters/.powershell-psscriptanalyzer.psd1 b/.github/linters/.powershell-psscriptanalyzer.psd1 index e9081f9a..09cc3d0c 100644 --- a/.github/linters/.powershell-psscriptanalyzer.psd1 +++ b/.github/linters/.powershell-psscriptanalyzer.psd1 @@ -51,7 +51,6 @@ } ExcludeRules = @( 'PSMissingModuleManifestField', # This rule is not applicable until the module is built. - 'PSAvoidUsingCmdletAliases', 'PSUseToExportFieldsInManifest' ) } diff --git a/scripts/helpers/Build/PSScriptAnalyzer.Tests.psd1 b/scripts/helpers/Build/PSScriptAnalyzer.Tests.psd1 index bd8fb923..9f7bc652 100644 --- a/scripts/helpers/Build/PSScriptAnalyzer.Tests.psd1 +++ b/scripts/helpers/Build/PSScriptAnalyzer.Tests.psd1 @@ -50,7 +50,6 @@ } } ExcludeRules = @( - 'PSAvoidUsingCmdletAliases', 'PSUseToExportFieldsInManifest' ) } diff --git a/scripts/main.ps1 b/scripts/main.ps1 index bb80c679..f2cb6cff 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -1,8 +1,12 @@ -#Requires -Modules Utilities - +[Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' +)] [CmdletBinding()] param() +#Requires -Modules Utilities + $path = (Join-Path -Path $PSScriptRoot -ChildPath 'helpers') | Get-Item | Resolve-Path -Relative LogGroup "Loading helper scripts from [$path]" { Get-ChildItem -Path $path -Filter '*.ps1' -Recurse | Resolve-Path -Relative | ForEach-Object { From 01d37d8bcba5a4ec662913062ade26f51dd16950 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 16 Feb 2025 12:25:16 +0100 Subject: [PATCH 04/10] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20module?= =?UTF-8?q?=20scripts=20to=20include=20required=20module=20annotations=20a?= =?UTF-8?q?nd=20improve=20documentation=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/helpers/Build-PSModule.ps1 | 7 ++--- scripts/helpers/Build/Build-PSModuleBase.ps1 | 23 ++++++++------ .../helpers/Build/Build-PSModuleManifest.ps1 | 25 ++++++++------- .../Build/Get-PSModuleAliasesToExport.ps1 | 9 ++++-- .../Build/Get-PSModuleCmdletsToExport.ps1 | 9 ++++-- .../Build/Get-PSModuleFunctionsToExport.ps1 | 4 +++ .../Build/Get-PSModuleVariablesToExport.ps1 | 4 +++ scripts/helpers/Build/Import-PSModule.ps1 | 9 ++++-- .../Build/Resolve-PSModuleDependency.ps1 | 31 ++++++++++--------- 9 files changed, 73 insertions(+), 48 deletions(-) diff --git a/scripts/helpers/Build-PSModule.ps1 b/scripts/helpers/Build-PSModule.ps1 index 4183d0bb..98f08789 100644 --- a/scripts/helpers/Build-PSModule.ps1 +++ b/scripts/helpers/Build-PSModule.ps1 @@ -1,7 +1,4 @@ -#Requires -Modules @{ ModuleName = 'GitHub'; ModuleVersion = '0.13.2' } -#Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } - -function Build-PSModule { +function Build-PSModule { <# .SYNOPSIS Builds a module. @@ -10,6 +7,8 @@ function Build-PSModule { Builds a module. #> [CmdletBinding()] + #Requires -Modules @{ ModuleName = 'GitHub'; ModuleVersion = '0.13.2' } + #Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSReviewUnusedParameter', '', Scope = 'Function', Justification = 'LogGroup - Scoping affects the variables line of sight.' diff --git a/scripts/helpers/Build/Build-PSModuleBase.ps1 b/scripts/helpers/Build/Build-PSModuleBase.ps1 index d8c49a87..ffb664dd 100644 --- a/scripts/helpers/Build/Build-PSModuleBase.ps1 +++ b/scripts/helpers/Build/Build-PSModuleBase.ps1 @@ -1,22 +1,25 @@ -#Requires -Modules @{ ModuleName = 'GitHub'; ModuleVersion = '0.13.2' } - -function Build-PSModuleBase { +function Build-PSModuleBase { <# - .SYNOPSIS - Compiles the base module files. + .SYNOPSIS + Compiles the base module files. - .DESCRIPTION - This function will compile the base module files. - It will copy the source files to the output folder and remove the files that are not needed. + .DESCRIPTION + This function will compile the base module files. + It will copy the source files to the output folder and remove the files that are not needed. - .EXAMPLE - Build-PSModuleBase -SourceFolderPath 'C:\MyModule\src\MyModule' -OutputFolderPath 'C:\MyModule\build\MyModule' + .EXAMPLE + Build-PSModuleBase -SourceFolderPath 'C:\MyModule\src\MyModule' -OutputFolderPath 'C:\MyModule\build\MyModule' #> [CmdletBinding()] + #Requires -Modules @{ ModuleName = 'GitHub'; ModuleVersion = '0.13.2' } [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSReviewUnusedParameter', '', Scope = 'Function', Justification = 'LogGroup - Scoping affects the variables line of sight.' )] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' + )] param( # Name of the module. [Parameter(Mandatory)] diff --git a/scripts/helpers/Build/Build-PSModuleManifest.ps1 b/scripts/helpers/Build/Build-PSModuleManifest.ps1 index 002232ad..2a611f0d 100644 --- a/scripts/helpers/Build/Build-PSModuleManifest.ps1 +++ b/scripts/helpers/Build/Build-PSModuleManifest.ps1 @@ -1,19 +1,18 @@ -#Requires -Modules @{ ModuleName = 'GitHub'; ModuleVersion = '0.13.2' } -#Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } - -function Build-PSModuleManifest { +function Build-PSModuleManifest { <# - .SYNOPSIS - Compiles the module manifest. + .SYNOPSIS + Compiles the module manifest. - .DESCRIPTION - This function will compile the module manifest. - It will generate the module manifest file and copy it to the output folder. + .DESCRIPTION + This function will compile the module manifest. + It will generate the module manifest file and copy it to the output folder. - .EXAMPLE - Build-PSModuleManifest -SourceFolderPath 'C:\MyModule\src\MyModule' -OutputFolderPath 'C:\MyModule\build\MyModule' + .EXAMPLE + Build-PSModuleManifest -SourceFolderPath 'C:\MyModule\src\MyModule' -OutputFolderPath 'C:\MyModule\build\MyModule' #> [CmdletBinding()] + #Requires -Modules @{ ModuleName = 'GitHub'; ModuleVersion = '0.13.2' } + #Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSAvoidLongLines', '', Scope = 'Function', Justification = 'Easier to read the multi ternery operators in a single line.' @@ -22,6 +21,10 @@ function Build-PSModuleManifest { 'PSReviewUnusedParameter', '', Scope = 'Function', Justification = 'LogGroup - Scoping affects the variables line of sight.' )] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' + )] param( # Name of the module. [Parameter(Mandatory)] diff --git a/scripts/helpers/Build/Get-PSModuleAliasesToExport.ps1 b/scripts/helpers/Build/Get-PSModuleAliasesToExport.ps1 index 036ae80d..5c8a990e 100644 --- a/scripts/helpers/Build/Get-PSModuleAliasesToExport.ps1 +++ b/scripts/helpers/Build/Get-PSModuleAliasesToExport.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } - -function Get-PSModuleAliasesToExport { +function Get-PSModuleAliasesToExport { <# .SYNOPSIS Gets the aliases to export from the module manifest. @@ -12,6 +10,11 @@ function Get-PSModuleAliasesToExport { Get-PSModuleAliasesToExport -SourceFolderPath 'C:\MyModule\src\MyModule' #> [CmdletBinding()] + #Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' + )] param( # Path to the folder where the module source code is located. [Parameter(Mandatory)] diff --git a/scripts/helpers/Build/Get-PSModuleCmdletsToExport.ps1 b/scripts/helpers/Build/Get-PSModuleCmdletsToExport.ps1 index 850c10c2..2e07f8c3 100644 --- a/scripts/helpers/Build/Get-PSModuleCmdletsToExport.ps1 +++ b/scripts/helpers/Build/Get-PSModuleCmdletsToExport.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } - -function Get-PSModuleCmdletsToExport { +function Get-PSModuleCmdletsToExport { <# .SYNOPSIS Gets the cmdlets to export from the module manifest. @@ -12,6 +10,11 @@ function Get-PSModuleCmdletsToExport { Get-PSModuleCmdletsToExport -SourceFolderPath 'C:\MyModule\src\MyModule' #> [CmdletBinding()] + #Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' + )] param( # Path to the folder where the module source code is located. [Parameter(Mandatory)] diff --git a/scripts/helpers/Build/Get-PSModuleFunctionsToExport.ps1 b/scripts/helpers/Build/Get-PSModuleFunctionsToExport.ps1 index 99f34967..03671c89 100644 --- a/scripts/helpers/Build/Get-PSModuleFunctionsToExport.ps1 +++ b/scripts/helpers/Build/Get-PSModuleFunctionsToExport.ps1 @@ -10,6 +10,10 @@ Get-PSModuleFunctionsToExport -SourceFolderPath 'C:\MyModule\src\MyModule' #> [CmdletBinding()] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' + )] [OutputType([array])] param( # Path to the folder where the module source code is located. diff --git a/scripts/helpers/Build/Get-PSModuleVariablesToExport.ps1 b/scripts/helpers/Build/Get-PSModuleVariablesToExport.ps1 index c842a30d..e2810ba8 100644 --- a/scripts/helpers/Build/Get-PSModuleVariablesToExport.ps1 +++ b/scripts/helpers/Build/Get-PSModuleVariablesToExport.ps1 @@ -10,6 +10,10 @@ Get-PSModuleVariablesToExport -SourceFolderPath 'C:\MyModule\src\MyModule' #> [OutputType([Collections.Generic.List[string]])] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' + )] [CmdletBinding()] param( # Path to the folder where the module source code is located. diff --git a/scripts/helpers/Build/Import-PSModule.ps1 b/scripts/helpers/Build/Import-PSModule.ps1 index 2797069d..79fa949a 100644 --- a/scripts/helpers/Build/Import-PSModule.ps1 +++ b/scripts/helpers/Build/Import-PSModule.ps1 @@ -1,6 +1,4 @@ -#Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } - -function Import-PSModule { +function Import-PSModule { <# .SYNOPSIS Imports a build PS module. @@ -14,6 +12,11 @@ function Import-PSModule { Imports a module located at $ModuleFolderPath with the name $ModuleName. #> [CmdletBinding()] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' + )] + #Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } param( # Path to the folder where the module source code is located. [Parameter(Mandatory)] diff --git a/scripts/helpers/Build/Resolve-PSModuleDependency.ps1 b/scripts/helpers/Build/Resolve-PSModuleDependency.ps1 index 4924d3e7..accf607c 100644 --- a/scripts/helpers/Build/Resolve-PSModuleDependency.ps1 +++ b/scripts/helpers/Build/Resolve-PSModuleDependency.ps1 @@ -1,25 +1,28 @@ -#Requires -Modules @{ ModuleName = 'Retry'; ModuleVersion = '0.1.3' } - -function Resolve-PSModuleDependency { +function Resolve-PSModuleDependency { <# - .SYNOPSIS - Resolve dependencies for a module based on the manifest file. + .SYNOPSIS + Resolve dependencies for a module based on the manifest file. - .DESCRIPTION - Resolve dependencies for a module based on the manifest file, following PSModuleInfo structure + .DESCRIPTION + Resolve dependencies for a module based on the manifest file, following PSModuleInfo structure - .EXAMPLE - Resolve-PSModuleDependency -Path 'C:\MyModule\MyModule.psd1' + .EXAMPLE + Resolve-PSModuleDependency -Path 'C:\MyModule\MyModule.psd1' - Installs all modules defined in the manifest file, following PSModuleInfo structure. + Installs all modules defined in the manifest file, following PSModuleInfo structure. - .NOTES - Should later be adapted to support both pre-reqs, and dependencies. - Should later be adapted to take 4 parameters sets: specific version ("requiredVersion" | "GUID"), latest version ModuleVersion, - and latest version within a range MinimumVersion - MaximumVersion. + .NOTES + Should later be adapted to support both pre-reqs, and dependencies. + Should later be adapted to take 4 parameters sets: specific version ("requiredVersion" | "GUID"), latest version ModuleVersion, + and latest version within a range MinimumVersion - MaximumVersion. #> + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' + )] [Alias('Resolve-PSModuleDependencies')] [CmdletBinding()] + #Requires -Modules @{ ModuleName = 'Retry'; ModuleVersion = '0.1.3' } param( # The path to the manifest file. [Parameter(Mandatory)] From 8cfe045e401e6f1d760dc61374cd1bbe39f8e459 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 16 Feb 2025 12:29:36 +0100 Subject: [PATCH 05/10] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20jscpd?= =?UTF-8?q?=20ignore=20patterns=20and=20suppress=20specific=20code=20analy?= =?UTF-8?q?sis=20warnings;=20modify=20build=20scripts=20to=20output=20mess?= =?UTF-8?q?ages=20directly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/linters/.jscpd.json | 2 +- scripts/helpers/Build-PSModule.ps1 | 4 ++++ tests/tools/1-build.ps1 | 2 +- tests/tools/2-build.ps1 | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/linters/.jscpd.json b/.github/linters/.jscpd.json index 91eb2f2d..6b21dd80 100644 --- a/.github/linters/.jscpd.json +++ b/.github/linters/.jscpd.json @@ -4,7 +4,7 @@ "consoleFull" ], "ignore": [ - "**/tests/*", + "**/tests/**", ".github/workflows/Action-Test.yml" ], "absolute": true diff --git a/scripts/helpers/Build-PSModule.ps1 b/scripts/helpers/Build-PSModule.ps1 index 98f08789..ef5c67cb 100644 --- a/scripts/helpers/Build-PSModule.ps1 +++ b/scripts/helpers/Build-PSModule.ps1 @@ -13,6 +13,10 @@ 'PSReviewUnusedParameter', '', Scope = 'Function', Justification = 'LogGroup - Scoping affects the variables line of sight.' )] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' + )] param( # Name of the module. [Parameter(Mandatory)] diff --git a/tests/tools/1-build.ps1 b/tests/tools/1-build.ps1 index f3a17f23..e762395b 100644 --- a/tests/tools/1-build.ps1 +++ b/tests/tools/1-build.ps1 @@ -1 +1 @@ -Write-Host "1 - Build script executed." +"1 - Build script executed." diff --git a/tests/tools/2-build.ps1 b/tests/tools/2-build.ps1 index d839b516..d2575a02 100644 --- a/tests/tools/2-build.ps1 +++ b/tests/tools/2-build.ps1 @@ -1 +1 @@ -Write-Host "2 - Build script executed." +"2 - Build script executed." From f38ceeeaf6a29a970933287d99a10a78c3a994f4 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 16 Feb 2025 12:31:23 +0100 Subject: [PATCH 06/10] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Reorder=20modul?= =?UTF-8?q?e=20requirements=20in=20Update-PSModuleManifestAliasesToExport?= =?UTF-8?q?=20function=20and=20adjust=20synopsis=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Build/Update-PSModuleManifestAliasesToExport.ps1 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/helpers/Build/Update-PSModuleManifestAliasesToExport.ps1 b/scripts/helpers/Build/Update-PSModuleManifestAliasesToExport.ps1 index eccabdb5..4d7732ba 100644 --- a/scripts/helpers/Build/Update-PSModuleManifestAliasesToExport.ps1 +++ b/scripts/helpers/Build/Update-PSModuleManifestAliasesToExport.ps1 @@ -1,10 +1,7 @@ -#Requires -Modules @{ ModuleName = 'GitHub'; ModuleVersion = '0.13.2' } -#Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } - -function Update-PSModuleManifestAliasesToExport { +function Update-PSModuleManifestAliasesToExport { <# - .SYNOPSIS - Updates the aliases to export in the module manifest. + .SYNOPSIS + Updates the aliases to export in the module manifest. #> [Diagnostics.CodeAnalysis.SuppressMessageAttribute( 'PSUseShouldProcessForStateChangingFunctions', '', Scope = 'Function', @@ -14,6 +11,8 @@ function Update-PSModuleManifestAliasesToExport { 'PSReviewUnusedParameter', '', Scope = 'Function', Justification = 'LogGroup - Scoping affects the variables line of sight.' )] + #Requires -Modules @{ ModuleName = 'GitHub'; ModuleVersion = '0.13.2' } + #Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } [CmdletBinding()] param( # Name of the module. From c3f2b2adae914197198b92ab4b36817117789a84 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 16 Feb 2025 12:36:06 +0100 Subject: [PATCH 07/10] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Suppress=20'PSA?= =?UTF-8?q?voidUsingWriteHost'=20warning=20in=20Update-PSModuleManifestAli?= =?UTF-8?q?asesToExport=20function=20for=20console=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../helpers/Build/Update-PSModuleManifestAliasesToExport.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/helpers/Build/Update-PSModuleManifestAliasesToExport.ps1 b/scripts/helpers/Build/Update-PSModuleManifestAliasesToExport.ps1 index 4d7732ba..47d64e45 100644 --- a/scripts/helpers/Build/Update-PSModuleManifestAliasesToExport.ps1 +++ b/scripts/helpers/Build/Update-PSModuleManifestAliasesToExport.ps1 @@ -11,6 +11,10 @@ 'PSReviewUnusedParameter', '', Scope = 'Function', Justification = 'LogGroup - Scoping affects the variables line of sight.' )] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSAvoidUsingWriteHost', '', Scope = 'Function', + Justification = 'Want to just write to the console, not the pipeline.' + )] #Requires -Modules @{ ModuleName = 'GitHub'; ModuleVersion = '0.13.2' } #Requires -Modules @{ ModuleName = 'Utilities'; ModuleVersion = '0.3.0' } [CmdletBinding()] From 7f58e72b9d09821254c5d7612bea532ab11f5639 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 16 Feb 2025 12:40:14 +0100 Subject: [PATCH 08/10] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Suppress=20'PSA?= =?UTF-8?q?voidUsingWriteHost'=20warning=20in=20main.ps1=20to=20allow=20co?= =?UTF-8?q?nsole=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/main.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/main.ps1 b/scripts/main.ps1 index f2cb6cff..d831ebef 100644 --- a/scripts/main.ps1 +++ b/scripts/main.ps1 @@ -1,5 +1,5 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute( - 'PSAvoidUsingWriteHost', '', Scope = 'Function', + 'PSAvoidUsingWriteHost', '', Justification = 'Want to just write to the console, not the pipeline.' )] [CmdletBinding()] From 1a110ed40cd56382d1ece00a8014d0e2d0289fcb Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 16 Feb 2025 12:47:37 +0100 Subject: [PATCH 09/10] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20jscpd?= =?UTF-8?q?=20ignore=20patterns=20to=20exclude=20additional=20script=20fil?= =?UTF-8?q?es=20from=20duplication=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/linters/.jscpd.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/linters/.jscpd.json b/.github/linters/.jscpd.json index 6b21dd80..9766ac48 100644 --- a/.github/linters/.jscpd.json +++ b/.github/linters/.jscpd.json @@ -5,7 +5,10 @@ ], "ignore": [ "**/tests/**", - ".github/workflows/Action-Test.yml" + ".github/workflows/Action-Test.yml", + "scripts/helpers/Build/Build-PSModuleManifest.ps1", + "scripts/helpers/Build/Build-PSModuleRootModule.ps1", + "scripts/helpers/Build/PSScriptAnalyzer.Tests.psd1" ], "absolute": true } From dc543abc123446fc7ce69d87b685f2d71e6959de Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 16 Feb 2025 12:51:31 +0100 Subject: [PATCH 10/10] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Update=20jscpd?= =?UTF-8?q?=20ignore=20patterns=20to=20use=20relative=20paths=20for=20bett?= =?UTF-8?q?er=20compatibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/linters/.jscpd.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/linters/.jscpd.json b/.github/linters/.jscpd.json index 9766ac48..7cc00e60 100644 --- a/.github/linters/.jscpd.json +++ b/.github/linters/.jscpd.json @@ -5,10 +5,10 @@ ], "ignore": [ "**/tests/**", - ".github/workflows/Action-Test.yml", - "scripts/helpers/Build/Build-PSModuleManifest.ps1", - "scripts/helpers/Build/Build-PSModuleRootModule.ps1", - "scripts/helpers/Build/PSScriptAnalyzer.Tests.psd1" + "**/.github/workflows/Action-Test.yml", + "**/scripts/helpers/Build/Build-PSModuleManifest.ps1", + "**/scripts/helpers/Build/Build-PSModuleRootModule.ps1", + "**/scripts/helpers/Build/PSScriptAnalyzer.Tests.psd1" ], "absolute": true }