* 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>
Set the -M flag to jq:
```text
λ jq --help mohkale@mk-desktop ~
jq - commandline JSON processor [version 1.7]
Usage: jq [options] <jq filter> [file...]
jq [options] --args <jq filter> [strings...]
jq [options] --jsonargs <jq filter> [JSON_TEXTS...]
jq is a tool for processing JSON inputs, applying the given filter to
its JSON text inputs and producing the filter's results as JSON on
standard output.
The simplest filter is ., which copies jq's input to its output
unmodified except for formatting. For more advanced filters see
the jq(1) manpage ("man jq") and/or https://jqlang.github.io/jq/.
Example:
$ echo '{"foo": 0}' | jq .
{
"foo": 0
}
Command options:
-n, --null-input use `null` as the single input value;
-R, --raw-input read each line as string instead of JSON;
-s, --slurp read all inputs into an array and use it as
the single input value;
-c, --compact-output compact instead of pretty-printed output;
-r, --raw-output output strings without escapes and quotes;
--raw-output0 implies -r and output NUL after each output;
-j, --join-output implies -r and output without newline after
each output;
-a, --ascii-output output strings by only ASCII characters
using escape sequences;
-S, --sort-keys sort keys of each object on output;
-C, --color-output colorize JSON output;
-M, --monochrome-output disable colored output;
--tab use tabs for indentation;
--indent n use n spaces for indentation (max 7 spaces);
--unbuffered flush output stream after each output;
--stream parse the input value in streaming fashion;
--stream-errors implies --stream and report parse error as
an array;
--seq parse input/output as application/json-seq;
-f, --from-file file load filter from the file;
-L directory search modules from the directory;
--arg name value set $name to the string value;
--argjson name value set $name to the JSON value;
--slurpfile name file set $name to an array of JSON values read
from the file;
--rawfile name file set $name to string contents of file;
--args consume remaining arguments as positional
string values;
--jsonargs consume remaining arguments as positional
JSON values;
-e, --exit-status set exit status code based on the output;
-V, --version show the version;
--build-configuration show jq's build configuration;
-h, --help show the help;
-- terminates argument processing;
Named arguments are also available as $ARGS.named[], while
positional arguments are available as $ARGS.positional[].
```
go-mod-ts-mode is used with go.mod files. These cannot be formatted with
gofmt; attempting to do so will lead to an error anyway. Note that also
the goimports tool won’t work with go.mod files.
Co-authored-by: Andreas Kurth <andreas.kurth@ionos.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.
* Suppress logs for ktlint
Recent versions of ktlint (mine's 0.48.2) have started including logs
in their output when the `--stdin` flag is given. These logs would end
up being included *into the file* by apheleia, which isn't what we
want.
Since emitting log messages is likely never a good idea when
formatting code, I just opted to disable them altogether using a
command line flag. This fixes the issue.
* Add change log message about ktlint fix