Skip to content

Commit 80f7106

Browse files
committed
Release 1.290.2025
1 parent 32b6d35 commit 80f7106

File tree

1 file changed

+94
-1
lines changed

1 file changed

+94
-1
lines changed

.github/workflows/test.yml

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,98 @@ jobs:
2929
Install-Module -Name PSScriptAnalyzer -Force -SkipPublisherCheck -Scope CurrentUser
3030
}
3131
32+
- name: Create PSScriptAnalyzer settings
33+
shell: pwsh
34+
run: |
35+
$settings = @'
36+
@{
37+
Severity = @('Warning')
38+
IncludeRules = @(
39+
'PSUseFullyQualifiedCmdletNames',
40+
'PSAvoidDefaultValueSwitchParameter',
41+
'PSAvoidUsingCmdletAliases',
42+
'PSAvoidAssignmentToAutomaticVariable',
43+
'PSAvoidDefaultValueForMandatoryParameter',
44+
'PSAvoidExclaimOperator',
45+
'PSAvoidGlobalAliases',
46+
'PSAvoidGlobalFunctions',
47+
'PSAvoidGlobalVars',
48+
'PSAvoidLongLines',
49+
'PSAvoidNullOrEmptyHelpMessageAttribute',
50+
'PSAvoidOverwritingBuiltInCmdlets',
51+
'PSReservedCmdletChar',
52+
'PSReservedParams',
53+
'PSAvoidSemicolonsAsLineTerminators',
54+
'PSAvoidShouldContinueWithoutForce',
55+
'PSAvoidTrailingWhitespace',
56+
'PSAvoidUsingDeprecatedManifestFields',
57+
'PSAvoidUsingDoubleQuotesForConstantString',
58+
'PSMisleadingBacktick',
59+
'PSMissingModuleManifestField',
60+
'PSPlaceOpenBrace',
61+
'PSPossibleIncorrectComparisonWithNull',
62+
'PSPossibleIncorrectUsageOfAssignmentOperator',
63+
'PSPossibleIncorrectUsageOfRedirectionOperator',
64+
'PSUseApprovedVerbs',
65+
'PSUseCmdletCorrectly',
66+
'PSUseCompatibleCmdlets',
67+
'PSUseConsistentIndentation',
68+
'PSUseConsistentWhitespace',
69+
'PSUseDeclaredVarsMoreThanAssignments',
70+
'PSUseLiteralInitializerForHashtable',
71+
'PSUseOutputTypeCorrectly',
72+
'PSUseProcessBlockForPipelineCommand',
73+
'PSShouldProcess',
74+
'PSUseShouldProcessForStateChangingFunctions',
75+
'PSUseSingularNouns',
76+
'PSUseSupportsShouldProcess',
77+
'PSUseToExportFieldsInManifest',
78+
'PSUseUsingScopeModifierInNewRunspaces'
79+
)
80+
ExcludeRules = @(
81+
'PSUseCorrectCasing',
82+
'PSUseCompatibleCommands',
83+
'PSAlignAssignmentStatement',
84+
'PSAvoidUsingEmptyCatchBlock',
85+
'PSReviewUnusedParameter',
86+
'PSAvoidInvokingEmptyMembers',
87+
'PSAvoidMultipleTypeAttributes',
88+
'PSAvoidUsingPositionalParameters',
89+
'PSUseBOMForUnicodeEncodedFile',
90+
'PSAvoidUsingUsernameAndPasswordParams',
91+
'PSAvoidUsingAllowUnencryptedAuthentication',
92+
'PSAvoidUsingBrokenHashAlgorithms',
93+
'PSAvoidUsingComputerNameHardcoded',
94+
'PSAvoidUsingConvertToSecureStringWithPlainText',
95+
'PSAvoidUsingInvokeExpression',
96+
'PSAvoidUsingPlainTextForPassword',
97+
'PSAvoidUsingWMICmdlet',
98+
'PSAvoidUsingWriteHost',
99+
'PSUseCompatibleSyntax',
100+
'PSUseCompatibleTypes',
101+
'PSPlaceCloseBrace',
102+
'PSProvideCommentHelp',
103+
'PSUsePSCredentialType',
104+
'PSUseUTF8EncodingForHelpFile',
105+
'PSDSCDscExamplesPresent',
106+
'PSDSCDscTestsPresent',
107+
'PSDSCReturnCorrectTypesForDSCFunctions',
108+
'PSDSCUseIdenticalMandatoryParametersForDSC',
109+
'PSDSCUseIdenticalParametersForDSC',
110+
'PSDSCStandardDSCFunctionsInResource',
111+
'PSDSCUseVerboseMessageInDSCResource'
112+
)
113+
IncludeDefaultRules = $true
114+
RecurseCustomRulePath = $false
115+
Rules = @{
116+
PSUseFullyQualifiedCmdletNames = @{
117+
Enabled = $true
118+
}
119+
}
120+
}
121+
'@
122+
$settings | Out-File -FilePath "${{ github.workspace }}/PSScriptAnalyzerSettings.psd1" -Encoding UTF8
123+
32124
- name: Run PSScriptAnalyzer
33125
shell: pwsh
34126
run: |
@@ -40,10 +132,11 @@ jobs:
40132
41133
$allFiles = @($scriptFiles) + @($moduleFiles)
42134
$issuesFound = $false
135+
$settingsPath = "${{ github.workspace }}/PSScriptAnalyzerSettings.psd1"
43136
44137
foreach ($file in $allFiles) {
45138
Write-Host "`nAnalyzing: $($file.FullName)" -ForegroundColor Yellow
46-
$results = Invoke-ScriptAnalyzer -Path $file.FullName -Severity Warning,Error
139+
$results = Invoke-ScriptAnalyzer -Path $file.FullName -Settings $settingsPath
47140
48141
if ($results) {
49142
$issuesFound = $true

0 commit comments

Comments
 (0)