You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -188,7 +188,7 @@ Pester-based ScriptAnalyzer Tests are located in `path/to/PSScriptAnalyzer/Tests
188
188
189
189
* Ensure [Pester 4.3.1](https://www.powershellgallery.com/packages/Pester/4.3.1) or higher is installed
190
190
* In the root folder of your local repository, run:
191
-
```PowerShell
191
+
```powershell
192
192
./build -Test
193
193
```
194
194
@@ -251,7 +251,7 @@ Suppressing Rules
251
251
You can suppress a rule by decorating a script/function or script/function parameter with .NET's [SuppressMessageAttribute](https://docs.microsoft.com/dotnet/api/system.diagnostics.codeanalysis.suppressmessageattribute).
252
252
`SuppressMessageAttribute`'s constructor takes two parameters: a category and a check ID. Set the `categoryID` parameter to the name of the rule you want to suppress and set the `checkID` parameter to a null or empty string. You can optionally add a third named parameter with a justification for suppressing the message:
253
253
254
-
```PowerShell
254
+
```powershell
255
255
function SuppressMe()
256
256
{
257
257
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSProvideCommentHelp', '', Justification='Just an example')]
@@ -265,7 +265,7 @@ function SuppressMe()
265
265
All rule violations within the scope of the script/function/parameter you decorate will be suppressed.
266
266
267
267
To suppress a message on a specific parameter, set the `SuppressMessageAttribute`'s `CheckId` parameter to the name of the parameter:
@@ -280,7 +280,7 @@ Use the `SuppressMessageAttribute`'s `Scope` property to limit rule suppression
280
280
281
281
Use the value `Function` to suppress violations on all functions within the attribute's scope. Use the value `Class` to suppress violations on all classes within the attribute's scope:
You can further restrict suppression based on a function/parameter/class/variable/object's name by setting the `SuppressMessageAttribute's``Target` property to a regular expression or a glob pattern. Few examples are given below.
297
297
298
298
Suppress `PSAvoidUsingWriteHost` rule violation in `start-bar` and `start-baz` but not in `start-foo` and `start-bam`:
If you place a PSScriptAnayzer settings file named `PSScriptAnalyzerSettings.psd1` in your project root, PSScriptAnalyzer will discover it if you pass the project root as the `Path` parameter.
0 commit comments