aboutsummaryrefslogtreecommitdiff
path: root/apheleia-formatters.el
diff options
context:
space:
mode:
authorMichael Eliachevitch <m.eliachevitch@posteo.de>2023-12-15 03:46:12 +0100
committerGitHub <noreply@github.com>2023-12-14 18:46:12 -0800
commit4a87523f80e2ca56c1e33203f6ca568e45387912 (patch)
tree8bd3816d80328f97b09da0fc37e4af19bfd18e49 /apheleia-formatters.el
parent53c0389b5ed23f0ead92d782e4f14d8780fb18e7 (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 'apheleia-formatters.el')
-rw-r--r--apheleia-formatters.el1
1 files changed, 1 insertions, 0 deletions
diff --git a/apheleia-formatters.el b/apheleia-formatters.el
index c5e7f93..42fa485 100644
--- a/apheleia-formatters.el
+++ b/apheleia-formatters.el
@@ -56,6 +56,7 @@
(denofmt-md . ("deno" "fmt" "-" "--ext" "md"))
(denofmt-ts . ("deno" "fmt" "-" "--ext" "ts"))
(denofmt-tsx . ("deno" "fmt" "-" "--ext" "tsx"))
+ (docformatter . ("apheleia-docformatter" inplace))
(dprint . ("dprint" "fmt" "--stdin" filepath))
(elm-format . ("elm-format" "--yes" "--stdin"))
(fish-indent . ("fish_indent"))