File tree 5 files changed +39
-3
lines changed
5 files changed +39
-3
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version" : " 0.2.0" ,
6
+ "configurations" : [
7
+ {
8
+ // Run this launch config and then set breakpoints in your module.
9
+ // Then you can `Import-Module -Force ./PowerShellForGitHub.psd1`
10
+ // and run a function that will hit the breakpoint.
11
+ "name" : " PowerShell: Interactive Session" ,
12
+ "type" : " PowerShell" ,
13
+ "request" : " launch" ,
14
+ "cwd" : " "
15
+ }
16
+ ]
17
+ }
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ Update-Module -Name PSScriptAnalyzer
153
153
Once it's installed (or updated), from the root of your enlistment simply call
154
154
155
155
``` powershell
156
- Invoke-ScriptAnalyzer -Path .\ -Recurse
156
+ Invoke-ScriptAnalyzer -Settings ./PSScriptAnalyzerSettings.psd1 - Path ./ -Recurse
157
157
```
158
158
159
159
That should return with no output. If you see any output when calling that command,
Original file line number Diff line number Diff line change
1
+ # PSScriptAnalyzerSettings.psd1
2
+ # Settings for PSScriptAnalyzer invocation.
3
+ # All default rules are also enabled.
4
+ @ {
5
+ Rules = @ {
6
+ PSUseCompatibleSyntax = @ {
7
+ # This turns the rule on (setting it to false will turn it off)
8
+ Enable = $true
9
+
10
+ # Simply list the targeted versions of PowerShell here
11
+ TargetVersions = @ (
12
+ ' 4.0' ,
13
+ ' 5.1' ,
14
+ ' 6.2' ,
15
+ ' 7.0'
16
+ )
17
+ }
18
+ }
19
+ }
Original file line number Diff line number Diff line change 9
9
displayName: 'Install PSScriptAnalyzer'
10
10
11
11
- powershell : |
12
- $results = try { Invoke-ScriptAnalyzer -Path ./ –Recurse -ErrorAction Stop } catch { $_.Exception.StackTrace; throw }
12
+ $results = try { Invoke-ScriptAnalyzer -Settings ./PSScriptAnalyzerSettings.psd1 - Path ./ –Recurse -ErrorAction Stop } catch { $_.Exception.StackTrace; throw }
13
13
$results | ForEach-Object { Write-Host "##vso[task.logissue type=$($_.Severity);sourcepath=$($_.ScriptPath);linenumber=$($_.Line);columnnumber=$($_.Column);]$($_.Message)" }
14
14
15
15
$null = New-Item -Path ..\ -Name ScriptAnalyzer -ItemType Directory -Force
Original file line number Diff line number Diff line change 16
16
Overwrite the file at Path if it exists.
17
17
18
18
. EXAMPLE
19
- $results = Invoke-ScriptAnalyzer -Path ./ -Recurse
19
+ $results = Invoke-ScriptAnalyzer -Settings ./PSScriptAnalyzerSettings.psd1 - Path ./ -Recurse
20
20
.\ConverTo-NUnitXml.ps1 -ScriptAnalyzerResult $results -Path ./PSScriptAnalyzerFailures.xml
21
21
#>
22
22
[CmdletBinding ()]
You can’t perform that action at this time.
0 commit comments