From 73b51824dfea898c856295ea484e153f8b498bc9 Mon Sep 17 00:00:00 2001 From: "Jos Verlinde[MSFT]" Date: Thu, 25 May 2017 14:18:44 +0200 Subject: [PATCH] Add 2 snippits to simplify supressing benign PSScriptAnalyzer errors and warnings --- snippets/PowerShell.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/snippets/PowerShell.json b/snippets/PowerShell.json index 169eb1ff60..5079e00f97 100644 --- a/snippets/PowerShell.json +++ b/snippets/PowerShell.json @@ -871,5 +871,21 @@ "}" ], "description": "sequence snippet (for use inside a workflow)" - } + }, + "PSSA warning override decoration.1": { + "prefix": "Suppress - PSSA", + "description": "Suppress warnings for a specific rule", + "body": [ + "#Suppress warning", + "[Diagnostics.CodeAnalysis.SuppressMessageAttribute('${1:PSUseDeclaredVarsMoreThanAssignments}', '$2')]" + ] + } + ,"PSSA warning override decoration.2": { + "prefix": "Suppress - PSSA", + "description": "Suppress warnings for a specific class, for a specific function", + "body": [ + "#Suppress warning", + "[Diagnostics.CodeAnalysis.SuppressMessageAttribute('${1:PSProvideDefaultParameterValue}', '$2', Scope='Function', Target='*')]" + ] + } }