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
Copy file name to clipboardExpand all lines: README.md
+16-11Lines changed: 16 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ Table of Contents
32
32
33
33
<!-- tocstop -->
34
34
35
-
Introduction
35
+
Introduction[↑](#table-of-contents)
36
36
============
37
37
PSScriptAnalyzer is a static code checker for Windows PowerShell modules and scripts. PSScriptAnalyzer checks the quality of Windows PowerShell code by running a set of rules.
38
38
The rules are based on PowerShell best practices identified by PowerShell Team and the community. It generates DiagnosticResults (errors and warnings) to inform users about potential
@@ -41,15 +41,16 @@ code defects and suggests possible solutions for improvements.
41
41
PSScriptAnalyzer is shipped with a collection of built-in rules that checks various aspects of PowerShell code such as presence of uninitialized variables, usage of PSCredential Type,
42
42
usage of Invoke-Expression etc. Additional functionalities such as exclude/include specific rules are also supported.
*[PlatyPS 0.5.0 or greater](https://github.com/PowerShell/platyPS)
80
81
81
82
#### Steps
@@ -89,6 +90,10 @@ Exit
89
90
```powershell
90
91
cd path/to/PSScriptAnalyzer
91
92
```
93
+
* Restore packages
94
+
```powershell
95
+
dotnet restore
96
+
```
92
97
* Build for your platform
93
98
* Windows PowerShell version 5.0 and greater
94
99
```powershell
@@ -130,7 +135,7 @@ cd /path/to/PSScriptAnalyzer/Tests/Rules
130
135
Invoke-Pester
131
136
```
132
137
133
-
Suppressing Rules
138
+
Suppressing Rules[↑](#table-of-contents)
134
139
=================
135
140
136
141
You can suppress a rule by decorating a script/function or script/function parameter with .NET's [SuppressMessageAttribute](https://msdn.microsoft.com/en-us/library/system.diagnostics.codeanalysis.suppressmessageattribute.aspx).
@@ -215,7 +220,7 @@ Param()
215
220
216
221
**Note**: Rule suppression is currently supported only for built-in rules.
217
222
218
-
Settings Support in ScriptAnalyzer
223
+
Settings Support in ScriptAnalyzer[↑](#table-of-contents)
219
224
========================================
220
225
Settings that describe ScriptAnalyzer rules to include/exclude based on `Severity` can be created and supplied to
221
226
`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.
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).
266
271
267
-
ScriptAnalyzer as a .NET library
272
+
ScriptAnalyzer as a .NET library[↑](#table-of-contents)
268
273
================================
269
274
270
275
ScriptAnalyzer engine and functionality can now be directly consumed as a library.
@@ -288,7 +293,7 @@ public System.Collections.Generic.IEnumerable<DiagnosticRecord> AnalyzePath(stri
Contributing to ScriptAnalyzer[↑](#table-of-contents)
352
357
==============================
353
358
You are welcome to contribute to this project. There are many ways to contribute:
354
359
@@ -369,6 +374,6 @@ You might also read these two blog posts about contributing code: [Open Source C
369
374
370
375
Before submitting a feature or substantial code contribution, please discuss it with the Windows PowerShell team via [Issues](https://github.com/PowerShell/PSScriptAnalyzer/issues), and ensure it follows the product roadmap. Note that all code submissions will be rigorously reviewed by the Windows PowerShell Team. Only those that meet a high bar for both quality and roadmap fit will be merged into the source.
371
376
372
-
Code of Conduct
377
+
Code of Conduct[↑](#table-of-contents)
373
378
===============
374
379
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
0 commit comments