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>
Make it so that if there is a `.formatter.exs` file somewhere in the
parent directories, then Apheleia will run `mix format` from there
instead of the current directory.
Close#232
Gets all non-elisp dependencies into a single directory,
`scripts/formatters`
<!--
To expedite the pull request process, please see the contributor guide
for my projects:
<https://github.com/raxod502/contributor-guide>
-->
This adds support for formatters installed locally in project
directories via yarn 2's "zero install" [pnp
mode](https://yarnpkg.com/features/pnp).
It's quite similar to the support for formatters installed locally in a
project's `node_modules` via npm, and leverages the `npx` symbol, so
existing formatter definitions should work without modification.
This checks for a `.pnp.cjs` file (expected in the project root for yarn
pnp projects), then looks for a yarn executable, and checks the version
of yarn to make sure it supports pnp. If that works, we just push
`"yarn"` onto the front of `command`.
I've only tested this with a locally installed `prettier.js`. It's very
much a works-for-me draft, I'm putting in a PR to make sure this is a
workable approach before going any further with it.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
* feat: add phpcs & introduce scripts/formatters
Add phpcs as a supported formatter, and include support for
apheleia-defined scripts for more troublesome formatters
* Revert Emacs version requirement
* More quoting
* Adjust language in documentation
* Thanks checkdoc, lol
Co-authored-by: Radon Rosborough <radon.neon@gmail.com>