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: .github/CONTRIBUTING.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,10 @@ Use `pre-commit install` to install the pre-commit hook for the repository.
6
6
7
7
### Creating a new formatter
8
8
9
-
- Implement a Formatter by inheriting from ``pydocstringformatter.formatting.Formatter``
10
-
- Add your new formatter to ``pydocstringformatter.formatting.FORMATTERS``
11
-
- Choose a proper name because this will be user-facing: the name will be used for options of the CLI.
9
+
- Implement a Formatter by inheriting from `pydocstringformatter.formatting.Formatter`
10
+
- Add your new formatter to `pydocstringformatter.formatting.FORMATTERS`
11
+
- Choose a proper name because this will be user-facing: the name will be used for
12
+
options of the CLI.
12
13
13
14
### Testing
14
15
@@ -18,9 +19,12 @@ To run all the tests:
18
19
pytest
19
20
```
20
21
21
-
To create test for a specific formatting option use the `tests/data/format` directory. For each `.py` file create a `.py.out` file with the expected output after formatting. The test suite will automatically pickup the new tests.
22
+
To create test for a specific formatting option use the `tests/data/format` directory.
23
+
For each `.py` file create a `.py.out` file with the expected output after formatting.
24
+
The test suite will automatically pickup the new tests.
22
25
23
-
To only run a specific test from that directory, for example `tests/data/format/multi_line/class_docstring.py`, use:
26
+
To only run a specific test from that directory, for example
A tool to automatically format Python docstrings that tries to follow recommendations from [`PEP 8`](https://www.python.org/dev/peps/pep-0008/) and [`PEP 257`](https://www.python.org/dev/peps/pep-0257/). See [What it does](#what-it-does) for currently supported auto-formatting.
8
+
A tool to automatically format Python docstrings that tries to follow recommendations
9
+
from [`PEP 8`](https://www.python.org/dev/peps/pep-0008/) and
10
+
[`PEP 257`](https://www.python.org/dev/peps/pep-0257/). See
11
+
[What it does](#what-it-does) for currently supported auto-formatting.
6
12
7
13
## How to install
8
14
@@ -26,24 +32,28 @@ options:
26
32
27
33
### Configuration
28
34
29
-
Pydocstringformatter will also read any configuration added to the `[tool.pydocstringformatter]` section of a `pyproject.toml` file.
35
+
Pydocstringformatter will also read any configuration added to the
36
+
`[tool.pydocstringformatter]` section of a `pyproject.toml` file.
30
37
31
38
## Pre-commit
32
39
33
-
Pydocstringformatter can also be used as a [pre-commit hook](https://pre-commit.com). Add the following to your `.pre-commit-config.yaml` file:
40
+
Pydocstringformatter can also be used as a [pre-commit hook](https://pre-commit.com).
41
+
Add the following to your `.pre-commit-config.yaml` file:
The following examples show what pydocstringformatter will pick up on. All _bad_ examples will be rewritten to follow the _good_ patterns.
52
+
The following examples show what pydocstringformatter will pick up on. All _bad_
53
+
examples will be rewritten to follow the _good_ patterns.
45
54
46
-
**PEP 8: _Note that most importantly, the """ that ends a multiline docstring should be on a line by itself:_**
55
+
**PEP 8: _Note that most importantly, the """ that ends a multiline docstring should be
56
+
on a line by itself:_**
47
57
48
58
```python
49
59
# Bad
@@ -56,7 +66,6 @@ multi-line docstring
56
66
"""
57
67
```
58
68
59
-
60
69
**PEP 256: _The closing quotes are on the same line as the opening quotes_**
61
70
62
71
For consistency this rule also gets applied to multi-line docstrings
@@ -86,4 +95,5 @@ multi-line docstring
86
95
87
96
## Development
88
97
89
-
For development and contributing guidelines please see [`Contributing`](https://github.com/DanielNoord/pydocstringformatter/blob/main/.github/CONTRIBUTING.md).
98
+
For development and contributing guidelines please see
0 commit comments