@@ -198,7 +198,77 @@ Describe 'UseCompatibleCommands' {
198
198
$diagnostics [$i ].TargetPlatform.PowerShell.Version.Minor | Should - Be $Version.Minor
199
199
}
200
200
}
201
+ }
202
+
203
+ Context " Checking a file against many targets" {
204
+ It " Finds all command problems" {
205
+ $settings = @ {
206
+ Rules = @ {
207
+ $script :RuleName = @ {
208
+ Enable = $true
209
+ $script :TargetProfileConfigKey = @ (
210
+ $script :Srv2012_3_profile
211
+ $script :Srv2012r2_4_profile
212
+ $script :Srv2012r2_6_1_profile
213
+ $script :Srv2016_5_profile
214
+ $script :Srv2016_6_1_profile
215
+ $script :Srv2019_5_profile
216
+ $script :Srv2019_6_1_profile
217
+ $script :Win10_5_profile
218
+ $script :Win10_6_1_profile
219
+ $script :Ubuntu1804_6_1_profile
220
+ $script :Debian8_6_1_profile
221
+ $script :Rhel76_6_1_profile
222
+ )
223
+ }
224
+ }
225
+ }
226
+
227
+ $diagnostics = Invoke-ScriptAnalyzer - Path " $PSScriptRoot /CompatibilityRuleAssets/IncompatibleScript.ps1" - IncludeRule $script :RuleName - Settings $settings
228
+
229
+ $diagnostics.Count | Should - Be 28
230
+
231
+ $diagnosticGroups = Group-Object - InputObject $diagnostics - Property Command
232
+
233
+ foreach ($group in $diagnosticGroups )
234
+ {
235
+ switch ($group.Name )
236
+ {
237
+ ' Get-EventLog'
238
+ {
239
+ $group.Count | Should - Be 7
240
+ break
241
+ }
242
+
243
+ ' Import-Module'
244
+ {
245
+ $group.Count | Should - Be 2
246
+ break
247
+ }
248
+
249
+ ' Invoke-WebRequest'
250
+ {
251
+ $group.Count | Should - Be 10
252
+ break
253
+ }
254
+
255
+ ' ogv'
256
+ {
257
+ $group.Count | Should - Be 7
258
+ break
259
+ }
260
+
261
+ ' Write-Information'
262
+ {
263
+ $group.Count | Should - Be 2
264
+ break
265
+ }
266
+ }
267
+ }
268
+ }
269
+ }
201
270
271
+ Context " Checking PSSA repository scripts" {
202
272
It " Ensures that PSSA build scripts are cross compatible with everything" {
203
273
$settings = @ {
204
274
Rules = @ {
0 commit comments