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
+55-5Lines changed: 55 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,8 @@ As a tool, `ni-python-styleguide` is installed like any other script:
25
25
pip install ni-python-styleguide
26
26
```
27
27
28
+
The script name `nps` is a short-name for `ni-python-styleguide`, and may be used in place of `ni-python-styleguide` in any CLI command.
29
+
28
30
### Linting
29
31
30
32
To lint, just run the `lint` subcommand (from within the project root, or lower):
@@ -34,7 +36,7 @@ ni-python-styleguide lint
34
36
# or
35
37
ni-python-styleguide lint ./dir/
36
38
# or
37
-
ni-python-styleguide lint module.py
39
+
nps lint module.py
38
40
```
39
41
40
42
The rules enforced are all rules documented in the written convention, which are marked as enforced.
@@ -46,10 +48,9 @@ However there are some situations you might need to configure the tool.
46
48
47
49
### Fix
48
50
49
-
`ni-python-styleguide` has a subcommand `fix` which will run [black](https://pypi.org/project/black/) and [isort](https://pycqa.github.io/isort/).
51
+
`ni-python-styleguide` has a subcommand `fix` which will run [black](https://pypi.org/project/black/) and [isort](https://pycqa.github.io/isort/) to apply basic formatting fixes.
50
52
51
-
Additionally, you can run `fix` with the `--aggressive` option and it will add acknowledgements (# noqa) for the remaining linting errors
52
-
it cannot fix, in addition to running black and isort.
53
+
When using the `--aggressive` option with `fix`, it will first run `black` and `isort` to fix what it can then add acknowledgements (`# noqa`) for any remaining linting errors that cannot be automatically fixed.
`ni-python-styleguide` has a subcommand `format` which will run [black](https://pypi.org/project/black/) and [isort](https://pycqa.github.io/isort/).
67
+
`ni-python-styleguide` has a subcommand `format` which will run [black](https://pypi.org/project/black/) and [isort](https://pycqa.github.io/isort/) with the correct settings to match the linting expectations.
67
68
68
69
If you wish to be able to invoke black directly, you'll want to set the following to get `black` formatting as the styleguide expects.
One can configure VSCode either in the [User 'settings.json' file](https://code.visualstudio.com/docs/configure/settings#_settings-json-file), or in a local [`.vscode/settings.json`](https://code.visualstudio.com/docs/configure/settings#_workspace-settingsjson-location).
114
+
115
+
116
+
1. Install the [Python extension by Microsoft](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
117
+
118
+
1. Because ni-python-styleguide is a wrapper around `flake8`, you can add the following configuration
119
+
to make it uses ni-python-styleguide's rules.
120
+
121
+
If using Poetry:
122
+
```json
123
+
"flake8.path": [
124
+
"poetry",
125
+
"run",
126
+
"ni-python-styleguide",
127
+
"lint"
128
+
],
129
+
```
130
+
If ni-python-styleguide is directly installed
131
+
```json
132
+
"flake8.path": [
133
+
"ni-python-styleguide",
134
+
"lint"
135
+
],
136
+
```
137
+
138
+
(alternatively, tell `flake8` to use the ni-python-styleguide config)
0 commit comments