diff options
| author | Michael Eliachevitch <m.eliachevitch@posteo.de> | 2023-12-15 03:46:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-14 18:46:12 -0800 |
| commit | 4a87523f80e2ca56c1e33203f6ca568e45387912 (patch) | |
| tree | 8bd3816d80328f97b09da0fc37e4af19bfd18e49 /scripts/formatters | |
| parent | 53c0389b5ed23f0ead92d782e4f14d8780fb18e7 (diff) | |
Add `docformatter` which formats Python docstrings to PEP 257 (#267)
Add [docformatter](https://github.com/PyCQA/docformatter) for Python
docstrings.
By default it outputs diffs but changes in-place with `--in-place`. On
successful change it exits with an error code of `3` (found out by
trial), so I had to add a formatter wrapping-script.
Initially I used `--in-place` with the special `in-place` symbol in
apheleia. But now I tried an approach where I transform the diff into
usable stdout using `patch` instead.
Related to #266 , where I had used the example of docformatter to ask
how to add scripts with positive exit codes and @raxod502 showed me the
`phpcs` solution.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
Diffstat (limited to 'scripts/formatters')
| -rwxr-xr-x | scripts/formatters/apheleia-docformatter | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/formatters/apheleia-docformatter b/scripts/formatters/apheleia-docformatter new file mode 100755 index 0000000..7de2337 --- /dev/null +++ b/scripts/formatters/apheleia-docformatter @@ -0,0 +1,5 @@ +#!/bin/sh +docformatter --in-place "$@" +if [ "$?" -eq 3 ]; then + exit 0 +fi |
