@@ -126,7 +126,7 @@ jobs:
126
126
cmake-lint --line-width 120 --tab-size 4 ${{ steps.cmake_files.outputs.found_files }}
127
127
128
128
- name : Docker - find files
129
- id : dokcer_files
129
+ id : docker_files
130
130
if : always()
131
131
run : |
132
132
found_files=$(find . -type f -iname "Dockerfile" -o -iname "*.dockerfile")
@@ -137,7 +137,7 @@ jobs:
137
137
echo found_files=${found_files} >> $GITHUB_OUTPUT
138
138
139
139
- name : Docker - hadolint
140
- if : always() && steps.dokcer_files .outputs.found_files
140
+ if : always() && steps.docker_files .outputs.found_files
141
141
run : |
142
142
docker pull hadolint/hadolint
143
143
@@ -156,7 +156,7 @@ jobs:
156
156
failed=0
157
157
failed_files=""
158
158
159
- for file in ${{ steps.dokcer_files .outputs.found_files }}; do
159
+ for file in ${{ steps.docker_files .outputs.found_files }}; do
160
160
echo "::group::${file}"
161
161
docker run --rm -i \
162
162
-e "NO_COLOR=0" \
@@ -174,6 +174,45 @@ jobs:
174
174
exit 1
175
175
fi
176
176
177
+ - name : PowerShell - PSScriptAnalyzer
178
+ if : always()
179
+ shell : pwsh
180
+ run : |
181
+ # PSScriptAnalyzer is already installed on GitHub runners
182
+
183
+ # To see a list of available rules, run the following command:
184
+ # Get-ScriptAnalyzerRule | Format-List
185
+
186
+ # Create PSScriptAnalyzer config file only if it doesn't exist
187
+ if (-not (Test-Path ./PSScriptAnalyzerSettings.psd1)) {
188
+ @'
189
+ @{
190
+ Severity=@(
191
+ 'Error',
192
+ 'Information',
193
+ 'Warning'
194
+ )
195
+ ExcludeRules=@(
196
+ 'PSAlignAssignmentStatement'
197
+ )
198
+ }
199
+ '@ | Out-File -FilePath ./PSScriptAnalyzerSettings.psd1
200
+ }
201
+
202
+ # Run PSScriptAnalyzer recursively on the whole repository
203
+ Write-Host "::group::Analyzing PowerShell files"
204
+ $results = Invoke-ScriptAnalyzer -Path "." -Recurse
205
+
206
+ if ($results) {
207
+ $results | Format-Table -AutoSize
208
+ Write-Host "::error::PSScriptAnalyzer found issues in PowerShell files"
209
+ Write-Host "::endgroup::"
210
+ exit 1
211
+ } else {
212
+ Write-Host "No issues found in PowerShell files"
213
+ Write-Host "::endgroup::"
214
+ }
215
+
177
216
- name : Python - flake8
178
217
if : always()
179
218
run : |
0 commit comments