Skip to content

Commit a36d570

Browse files
Josverldaviwil
authored andcommitted
Add 2 snippits to simplify supressing benign PSScriptAnalyzer errors and warnings
1 parent 0abede3 commit a36d570

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

snippets/PowerShell.json

+17-1
Original file line numberDiff line numberDiff line change
@@ -871,5 +871,21 @@
871871
"}"
872872
],
873873
"description": "sequence snippet (for use inside a workflow)"
874-
}
874+
},
875+
"PSSA warning override decoration.1": {
876+
"prefix": "Suppress - PSSA",
877+
"description": "Suppress warnings for a specific rule",
878+
"body": [
879+
"#Suppress warning",
880+
"[Diagnostics.CodeAnalysis.SuppressMessageAttribute('${1:PSUseDeclaredVarsMoreThanAssignments}', '$2')]"
881+
]
882+
}
883+
,"PSSA warning override decoration.2": {
884+
"prefix": "Suppress - PSSA",
885+
"description": "Suppress warnings for a specific class, for a specific function",
886+
"body": [
887+
"#Suppress warning",
888+
"[Diagnostics.CodeAnalysis.SuppressMessageAttribute('${1:PSProvideDefaultParameterValue}', '$2', Scope='Function', Target='*')]"
889+
]
890+
}
875891
}

0 commit comments

Comments
 (0)