Hi,
pyang (https://github.com/mbj4668/pyang) is a YANG validator,
transformator and code generator, written in python. YANG (RFC 7950) is
a data modeling language for NETCONF (RFC 6241), developed by the IETF
NETMOD WG. This formatter provides support for Emacs yang-mode.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
`ruff` doesn't run isort as part of its format, so to maintain parity
with the sort rules that black/isort offer, this is the ruff isort.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
This formatter is formatting via
[treefmt](https://numtide.github.io/treefmt). This is useful if the
project is configuring formatters for the project and you don't have to
replicate this logic within Emacs, but instead utilize treefmt directly.
To do that you can set the `apheleia-formatter` to `treefmt` within the
projects `.dir-locals.el`.
I noticed there are tests for this, since treefmt could technically
format anything, I went with treefmt formatting rust code. It also
relies on having a `treefmt.toml` in the project folder, so had to add
that as well in the tests.
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>
<!--
To expedite the pull request process, please see the contributor guide
for my projects:
<https://github.com/raxod502/contributor-guide>
-->
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
This also fixes a few test installers:
- rustfmt is available via apt-get in 22.04, use that instead of tarball
that's no longer available
- brittany now installs cleanly in the default haskell ghc/cabal in
22.04, so just use that
- perltidy in 22.04 has slightly different output
- nixfmt download url changed (now includes OS/arch). There was
initially no binary available when nixfmt was updated,
but the devs there were kind enough to provide one:
https://github.com/serokell/nixfmt/issues/139
This runs a full `make fmt-build` without errors, though it takes a
while ;). All tests pass, too.
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>
CLOSES#212
PR to restructure apheleia to make it more modular and improve some of
the separation of concerns. Before merging we should make sure that we
don't reintroduce the issues from #181.
* Fix brittany installation, needed the `--reorder-goals` argument to be
added so that a version that was not the latest version could be
installed so that it was compatible with the base lib version shipped
with Ubuntu 20.04. We'll upgrade to 22.04 eventually (before it falls
out of LTS). Ref: https://github.com/radian-software/apheleia/pull/221
* Add a `make fmt-build-common` target which allows tagging a docker
image containing just the base software and not any formatters, to make
it easy to debug formatter installation manually.
* Update `apheleia-ft` to also run formatter tests when any files
affecting a formatter are changed, which includes the installation
script, the sample input/output, and also any scripts (e.g.
`apheleia-phpcs`) that it uses. We don't have any logic that will run
all formatter tests at once, because that is unwieldy. That can be done
manually if making a big change.
* Update to actions/checkout@v4 from v2 because the older one was listed
as deprecated.
* Print full stacktraces when `apheleia-ft` fails with an Elisp error.
While running a full `make fmt-build`, I got some failures with
installer scripts for golang formatters. This fixes the problem by
installing an up-to-date golang instead of the version available in
ubuntu 20.04.
The ppa used here, `longsleep/golang-backports` is
[recommended](https://github.com/golang/go/wiki/Ubuntu) by the Go
project.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
Found while trying to `make fmt-build` that the installer for `brittany`
was broken, and couldn't fix it.
This removes brittany, and adds the ormolu and fourmolu formatters for
haskell, and sets ormolu as the default for haskell-mode.
---------
Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
Moves the bulk of apheleia.el into a new apheleia-core.el file and move
formatter definitions and mode-associations into a new
apheleia-formatters.el file. The end user experience should be
unchanged. Loading `apheleia.el` will still load everything load
everything, just like it used to.