Skip to content

Commit b3e9f7a

Browse files
committed
docs: updated README.md
1 parent 32e72a7 commit b3e9f7a

1 file changed

Lines changed: 39 additions & 10 deletions

File tree

README.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
# pre-commit-psscriptanalyzer
22

3-
![Pre-Commit](https://github.com/melmorabity/pre-commit-psscriptanalyzer/actions/workflows/pre-commit.yml/badge.svg)
3+
![Pre-Commit](https://github.com/ophiosdev/pre-commit-psscriptanalyzer.git/actions/workflows/pre-commit.yml/badge.svg)
44

5-
This project provides [pre-commit](https://pre-commit.com/) hooks to lint and format PowerShell code, using the [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer/) static code checker.
5+
This project provides [pre-commit](https://pre-commit.com/) hooks to lint and
6+
format PowerShell code, using the
7+
[PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer/) static code
8+
checker.
69

710
## Setup
811

9-
To activate the hooks, add the following lines to the `repos` list in the project's `.pre-commit-config.yaml` file:
12+
To activate the hooks, add the following lines to the `repos` list in the
13+
project's `.pre-commit-config.yaml` file:
1014

1115
```yaml
1216
---
1317
repos:
14-
- repo: https://github.com/melmorabity/pre-commit-psscriptanalyzer
15-
rev: v1.0.0
18+
- repo: https://github.com/ophiosdev/pre-commit-psscriptanalyzer.git
19+
rev: v2.0.0
1620
hooks:
1721
# Check PowerShell code
1822
- id: psscriptanalyzer-check
@@ -22,13 +26,14 @@ repos:
2226
2327
These hooks require [PowerShell](https://learn.microsoft.com/powershell/scripting/install/installing-powershell) to run.
2428
25-
Alternatively use this to run the hooks with Docker (so no dependency on PowerShell is needed):
29+
Alternatively use this to run the hooks with Docker (so no dependency on
30+
PowerShell is needed):
2631
2732
```yaml
2833
---
2934
repos:
30-
- repo: https://github.com/melmorabity/pre-commit-psscriptanalyzer
31-
rev: v1.0.0
35+
- repo: https://github.com/ophiosdev/pre-commit-psscriptanalyzer.git
36+
rev: v2.0.0
3237
hooks:
3338
# Check PowerShell code
3439
- id: psscriptanalyzer-check-docker
@@ -40,7 +45,11 @@ repos:
4045
4146
### psscriptanalyzer-check
4247
43-
The `psscriptanalyzer-check` hook performs checks on PowerShell code, based on [selected best practice rules](https://github.com/PowerShell/PSScriptAnalyzer/tree/master/docs/Rules). It supports the following options from the PSScriptAnalyzer function [`Invoke-ScriptAnalyzer`](https://learn.microsoft.com/en-us/powershell/module/psscriptanalyzer/invoke-scriptanalyzer):
48+
The `psscriptanalyzer-check` hook performs checks on PowerShell code, based on
49+
[selected best practice
50+
rules](https://github.com/PowerShell/PSScriptAnalyzer/tree/master/docs/Rules).
51+
It supports the following options from the PSScriptAnalyzer function
52+
[`Invoke-ScriptAnalyzer`](https://learn.microsoft.com/en-us/powershell/module/psscriptanalyzer/invoke-scriptanalyzer):
4453

4554
* [`-CustomRulePath`](https://learn.microsoft.com/en-us/powershell/module/psscriptanalyzer/invoke-scriptanalyzer#-customrulepath)
4655
* [`-ExcludeRule`](https://learn.microsoft.com/en-us/powershell/module/psscriptanalyzer/invoke-scriptanalyzer#-excluderule)
@@ -55,9 +64,29 @@ The `psscriptanalyzer-check` hook performs checks on PowerShell code, based on [
5564

5665
The `psscriptanalyzer-check-docker` hook supports the same options.
5766

67+
To pass multiple values like to the `-ExcludeRule` parameter, create a
68+
**single** string where the values are separated by a `,` (comma) **without**
69+
any whitespaces
70+
71+
```yaml
72+
---
73+
repos:
74+
- repo: https://github.com/ophiosdev/pre-commit-psscriptanalyzer.git
75+
rev: v2.0.0
76+
hooks:
77+
# Check PowerShell code
78+
- id: psscriptanalyzer-check
79+
args:
80+
- '-ExcludeRule'
81+
- 'PSAvoidUsingConvertToSecureStringWithPlainText,PSAvoidUsingWriteHost'
82+
```
83+
5884
### psscriptanalyzer-format
5985

60-
The `psscriptanalyzer-format` formats PowerShell code to a canonical format. It supports the following options from the PSScriptAnalyzer function [`Invoke-Formatter`](https://learn.microsoft.com/en-us/powershell/module/psscriptanalyzer/invoke-formatter) :
86+
The `psscriptanalyzer-format` formats PowerShell code to a canonical format. It
87+
supports the following options from the PSScriptAnalyzer function
88+
[`Invoke-Formatter`](https://learn.microsoft.com/en-us/powershell/module/psscriptanalyzer/invoke-formatter)
89+
:
6190

6291
* [`-Range`](https://learn.microsoft.com/en-us/powershell/module/psscriptanalyzer/invoke-formatter#-range)
6392
* [`-Settings`](https://learn.microsoft.com/en-us/powershell/module/psscriptanalyzer/invoke-formatter#-settings)

0 commit comments

Comments
 (0)