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
-[Using custom rules in Visual Studio Code](#using-custom-rules-in-visual-studio-code)
29
32
-[ScriptAnalyzer as a .NET library](#scriptanalyzer-as-a-net-library)
30
33
-[Violation Correction](#violation-correction)
31
34
-[Contributions are welcome](#contributions-are-welcome)
@@ -318,7 +321,10 @@ Settings Support in ScriptAnalyzer
318
321
Settings that describe ScriptAnalyzer rules to include/exclude based on `Severity` can be created and supplied to
319
322
`Invoke-ScriptAnalyzer` using the `Setting` parameter. This enables a user to create a custom configuration for a specific environment. We support the following modes for specifying the settings file.
320
323
321
-
## Built-in Presets
324
+
## Using parameter Settings
325
+
326
+
### Built-in Presets
327
+
322
328
ScriptAnalyzer ships a set of built-in presets that can be used to analyze scripts. For example, if the user wants to run *PowerShell Gallery* rules on their module, then they use the following command.
Along with `PSGallery` there are a few other built-in presets, including, `DSC` and `CodeFormatting`, that can be used. These presets can be tab completed for the `Settings` parameter.
329
335
330
-
## Explicit
336
+
###Explicit
331
337
332
338
The following example excludes two rules from the default set of rules and any rule
333
339
that does not output an Error or Warning diagnostic record.
@@ -362,7 +368,8 @@ Then invoke that settings file:
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.
Note that providing settings explicitly takes higher precedence over this implicit mode. Sample settings files are provided [here](https://github.com/PowerShell/PSScriptAnalyzer/tree/master/Engine/Settings).
373
380
381
+
## Custom rules
382
+
383
+
It is possible to provide one or more paths to custom rules in the settings file.
384
+
It is important that these paths either point to a module's folder (implicitly
385
+
uses the module manifest) or to the module's script file (.psm1). The module
386
+
should export the custom rules (as functions) for them to be available to
387
+
PS Script Analyzer.
388
+
389
+
In this example the property `CustomRulePath` points to two different modules.
390
+
Both modules exports the rules (the functions) with the verb `Measure`
0 commit comments