|
17 | 17 | # Optional: Additional params to add to any tool using PoliCheck. |
18 | 18 | [string[]] $PoliCheckAdditionalRunConfigParams, |
19 | 19 | # Optional: Additional params to add to any tool using CodeQL/Semmle. |
20 | | - [string[]] $CodeQLAdditionalRunConfigParams |
| 20 | + [string[]] $CodeQLAdditionalRunConfigParams, |
| 21 | + # Optional: Additional params to add to any tool using Binskim. |
| 22 | + [string[]] $BinskimAdditionalRunConfigParams |
21 | 23 | ) |
22 | 24 |
|
23 | 25 | $ErrorActionPreference = 'Stop' |
@@ -69,22 +71,32 @@ try { |
69 | 71 | $gdnConfigFile = Join-Path $gdnConfigPath "$toolConfigName-configure.gdnconfig" |
70 | 72 |
|
71 | 73 | # For some tools, add default and automatic args. |
72 | | - if ($tool.Name -eq 'credscan') { |
73 | | - if ($targetDirectory) { |
74 | | - $tool.Args += "`"TargetDirectory < $TargetDirectory`"" |
| 74 | + switch -Exact ($tool.Name) { |
| 75 | + 'credscan' { |
| 76 | + if ($targetDirectory) { |
| 77 | + $tool.Args += "`"TargetDirectory < $TargetDirectory`"" |
| 78 | + } |
| 79 | + $tool.Args += "`"OutputType < pre`"" |
| 80 | + $tool.Args += $CrScanAdditionalRunConfigParams |
75 | 81 | } |
76 | | - $tool.Args += "`"OutputType < pre`"" |
77 | | - $tool.Args += $CrScanAdditionalRunConfigParams |
78 | | - } elseif ($tool.Name -eq 'policheck') { |
79 | | - if ($targetDirectory) { |
80 | | - $tool.Args += "`"Target < $TargetDirectory`"" |
| 82 | + 'policheck' { |
| 83 | + if ($targetDirectory) { |
| 84 | + $tool.Args += "`"Target < $TargetDirectory`"" |
| 85 | + } |
| 86 | + $tool.Args += $PoliCheckAdditionalRunConfigParams |
81 | 87 | } |
82 | | - $tool.Args += $PoliCheckAdditionalRunConfigParams |
83 | | - } elseif ($tool.Name -eq 'semmle' -or $tool.Name -eq 'codeql') { |
84 | | - if ($targetDirectory) { |
85 | | - $tool.Args += "`"SourceCodeDirectory < $TargetDirectory`"" |
| 88 | + {$_ -in 'semmle', 'codeql'} { |
| 89 | + if ($targetDirectory) { |
| 90 | + $tool.Args += "`"SourceCodeDirectory < $TargetDirectory`"" |
| 91 | + } |
| 92 | + $tool.Args += $CodeQLAdditionalRunConfigParams |
| 93 | + } |
| 94 | + 'binskim' { |
| 95 | + if ($targetDirectory) { |
| 96 | + $tool.Args += "`"Target < $TargetDirectory\**`"" |
| 97 | + } |
| 98 | + $tool.Args += $BinskimAdditionalRunConfigParams |
86 | 99 | } |
87 | | - $tool.Args += $CodeQLAdditionalRunConfigParams |
88 | 100 | } |
89 | 101 |
|
90 | 102 | # Create variable pointing to the args array directly so we can use splat syntax later. |
|
0 commit comments