Skip to content

Commit 5501611

Browse files
mnarusmshafer-NI
andauthored
Document fix subcommand (#127)
* Fix BLK100 issue * make some doc changes for fix * Update docs for fix * Update docs/Coding-Conventions.md Co-authored-by: mshafer-NI <[email protected]> * Update README.md Co-authored-by: mshafer-NI <[email protected]> * address feedback * typo --------- Co-authored-by: mshafer-NI <[email protected]>
1 parent 02a4109 commit 5501611

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ The rules enforced are all rules documented in the written convention, which are
4444
`ni-python-styleguide` aims to keep the configuration to a bare minimum (none wherever possible).
4545
However there are some situations you might need to configure the tool.
4646

47+
### Fix
48+
49+
`ni-python-styleguide` has a subcommand `fix` which will run [black](https://pypi.org/project/black/) and [isort](https://pycqa.github.io/isort/).
50+
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+
4754
#### When using `setup.py`
4855

4956
If you're using `setup.py`, you'll need to set your app's import names for import sorting.

docs/Coding-Conventions.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Additionally rules might be suffixed with one of the below:
2929

3030
> 💻 - The convention is automatically enforced by `ni-python-styleguide` (By running `ni-python-styleguide lint ...`)
3131
>
32-
> ✨ - The convention is automatically fixed by `ni-python-stylgeuide` (`ni-python-styleguide` command doesn't exist yet)
32+
> ✨ - The convention is automatically fixed by `ni-python-styleguide` (By running `ni-python-styleguide fix ...`)
3333
3434
# This vs. other guides (like PEPs)
3535

@@ -62,6 +62,8 @@ This document is applicable to all Python versions which are not end-of-life.
6262
### [F.1.1] ✔️ **DO** Use `black` to format your code 💻
6363

6464
> 💻 This rule is enforced by error code BLK100
65+
66+
> ✨ This is automatically fixed by running `ni-python-styleguide fix`
6567
6668
`black`'s style is well-documented and can be found [here](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html).
6769

@@ -690,6 +692,8 @@ This includes packages, modules, classes, functions, attributes and other names.
690692
691693
> 💻 This rule is enforced by error code E401
692694
695+
> ✨ This is automatically fixed by running `ni-python-styleguide fix`
696+
693697
```python
694698
# Bad
695699
import sys, os
@@ -732,6 +736,8 @@ URL = "http://python.org"
732736
733737
> 💻 This rule is enforced by error codes I201, I202
734738
739+
> ✨ This is automatically fixed by running `ni-python-styleguide fix`
740+
735741
Additionally, you should put a single blank line between each group of imports.
736742

737743
```python
@@ -765,6 +771,8 @@ import my_app.utils
765771

766772
> 💻 This rule is enforced by error code I100
767773
774+
> ✨ This is automatically fixed by running `ni-python-styleguide fix`
775+
768776
`from X import Y` imports should follow `import X` imports and be alphabetized by module name.
769777

770778
```python
@@ -1002,6 +1010,8 @@ Each documented object should have a one-line summary (with less detail than the
10021010

10031011
> 🐍 This rule stems from [PEP 257](https://www.python.org/dev/peps/pep-0257/#multi-line-docstrings)
10041012
1013+
ℹ️ An exception is made for tests as they should already have a very descriptive name
1014+
10051015
This includes (if applicable) the function's:
10061016

10071017
- arguments (including optional arguments, and keyword arguments)
@@ -1246,6 +1256,8 @@ class CheeseShop(object):
12461256

12471257
> 🐍 This rule stems from [PEP 8](https://www.python.org/dev/peps/pep-0008)
12481258
1259+
> ✨ This is automatically fixed by running `ni-python-styleguide fix`
1260+
12491261
```python
12501262
# Good
12511263
order = ["egg", "sausage", "bacon"] # The client doesn't want any spam

0 commit comments

Comments
 (0)