diff --git a/changelogs/fragments/psscriptanalyzer-1.21.0.yml b/changelogs/fragments/psscriptanalyzer-1.21.0.yml new file mode 100644 index 00000000000..e74b3d6b83a --- /dev/null +++ b/changelogs/fragments/psscriptanalyzer-1.21.0.yml @@ -0,0 +1,4 @@ +minor_changes: +- >- + ansible-test pslint - Upgrade PSScriptAnalyzer to ``1.21.0`` which enables the ``AvoidMultipleTypeAttributes``, + ``AvoidSemicolonsAsLineTerminators``, and ``AvoidUsingBrokenHashAlgorithms`` rules diff --git a/test/lib/ansible_test/_data/requirements/sanity.pslint.ps1 b/test/lib/ansible_test/_data/requirements/sanity.pslint.ps1 index 68545c9e94f..df36d61affa 100644 --- a/test/lib/ansible_test/_data/requirements/sanity.pslint.ps1 +++ b/test/lib/ansible_test/_data/requirements/sanity.pslint.ps1 @@ -28,8 +28,10 @@ Function Install-PSModule { } } +# Versions changes should be made first in ansible-test which is then synced to +# the default-test-container over time Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -Install-PSModule -Name PSScriptAnalyzer -RequiredVersion 1.20.0 +Install-PSModule -Name PSScriptAnalyzer -RequiredVersion 1.21.0 if ($IsContainer) { # PSScriptAnalyzer contain lots of json files for the UseCompatibleCommands check. We don't use this rule so by diff --git a/test/lib/ansible_test/_util/controller/sanity/pslint/settings.psd1 b/test/lib/ansible_test/_util/controller/sanity/pslint/settings.psd1 index 2ae13b4c2e5..41be367404b 100644 --- a/test/lib/ansible_test/_util/controller/sanity/pslint/settings.psd1 +++ b/test/lib/ansible_test/_util/controller/sanity/pslint/settings.psd1 @@ -1,37 +1,40 @@ @{ - Rules = @{ - PSAvoidLongLines = @{ - Enable = $true + Rules = @{ + PSAvoidLongLines = @{ + Enable = $true MaximumLineLength = 160 } - PSPlaceOpenBrace = @{ + PSAvoidSemicolonsAsLineTerminators = @{ Enable = $true - OnSameLine = $true + } + PSPlaceOpenBrace = @{ + Enable = $true + OnSameLine = $true IgnoreOneLineBlock = $true - NewLineAfter = $true + NewLineAfter = $true } - PSPlaceCloseBrace = @{ - Enable = $true + PSPlaceCloseBrace = @{ + Enable = $true IgnoreOneLineBlock = $true - NewLineAfter = $true - NoEmptyLineBefore = $false + NewLineAfter = $true + NoEmptyLineBefore = $false } - PSUseConsistentIndentation = @{ - Enable = $true - IndentationSize = 4 + PSUseConsistentIndentation = @{ + Enable = $true + IndentationSize = 4 PipelineIndentation = 'IncreaseIndentationForFirstPipeline' - Kind = 'space' + Kind = 'space' } - PSUseConsistentWhitespace = @{ - Enable = $true - CheckInnerBrace = $true - CheckOpenBrace = $true - CheckOpenParen = $true - CheckOperator = $true - CheckPipe = $true - CheckPipeForRedundantWhitespace = $false - CheckSeparator = $true - CheckParameter = $false + PSUseConsistentWhitespace = @{ + Enable = $true + CheckInnerBrace = $true + CheckOpenBrace = $true + CheckOpenParen = $true + CheckOperator = $true + CheckPipe = $true + CheckPipeForRedundantWhitespace = $false + CheckSeparator = $true + CheckParameter = $false IgnoreAssignmentOperatorInsideHashTable = $false } }