Commit graph

265 commits

Author SHA1 Message Date
Radon Rosborough
4ebc10b623
[#203] Clarify how lisp functions format (#216)
Help alleviate confusion like
https://github.com/radian-software/apheleia/issues/203.

---------

Co-authored-by: Mohsin Kaleem <mohkale@kisara.moe>
2023-10-12 20:04:59 -07:00
Radon Rosborough
791346cd3a
Fix brittany formatter & misc improvements (#222)
* 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.
2023-10-06 22:01:38 -07:00
Ed Slocomb
35f72f6fbe
use up-to-date golang (#218)
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>
2023-10-06 21:47:52 -07:00
Ed Slocomb
afa0e54e43
Add ormolu and fourmolu, remove brittany (#221)
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>
2023-10-06 21:39:38 -07:00
Radon Rosborough
970b331171 Update changelog 2023-09-30 21:40:48 -07:00
realazy
1fae320aae
Use prettier-json for js-json-mode (#209)
By default Emacs 29 uses `js-json-mode` for JSON file (correct me if I'm
wrong), this pr enables the right formatter for this mode.
2023-09-30 21:40:04 -07:00
Mohsin Kaleem
bac7277ed0
Run jq without colorization (#213)
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[].
```
2023-09-30 16:40:18 -07:00
Mohsin Kaleem
c7e41940ca Update changelog for last commit 2023-09-30 09:37:20 +01:00
Andreas Kurth
da31e1b7f3
Remove go-mod-ts-mode from apheleia-mode-alist (#214)
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>
2023-09-30 09:32:06 +01:00
Radon Rosborough
e944e24584
Make apheleia-mode-alist order-independent(-ish) (#207)
Solves https://github.com/radian-software/apheleia/issues/206
2023-09-09 16:13:13 -07:00
Radon Rosborough
937fe9a940 Fix CI triggers 2023-08-26 10:18:51 -07:00
Radon Rosborough
108176abe5 Update links 2023-08-26 09:05:35 -07:00
Radon Rosborough
5b287a9426 Fix compilation order 2023-08-26 09:05:29 -07:00
Ed Slocomb
706d6bd347
Add ruby-standard formatter (#201)
There are *so many* opinionated no-config ruby formatters ;)
2023-08-11 17:25:58 -07:00
Radon Rosborough
881b5e80a8 [#199] Autoload apheleia-formatter 2023-08-11 17:25:11 -07:00
Radon Rosborough
c222927f70 Add notes on .dir-locals.el to README
Closes #190
2023-07-19 17:21:07 -07:00
Semen
f85b48e2ee
Add yapf formatter (#196)
<!--

To expedite the pull request process, please see the contributor guide
for my projects:

  <https://github.com/raxod502/contributor-guide>

-->
2023-05-27 10:55:56 -07:00
dalu
d4a5965d29
Add more tree-sitter based modes (#191) 2023-05-12 17:48:33 -07:00
Radon Rosborough
01f2f0da56 Fix safe-local-variable for apheleia-formatter 2023-05-06 15:26:17 -07:00
Mohsin Kaleem
e9e595f003
Add rufo formatter (#177) 2023-04-22 11:56:29 +01:00
Mohsin Kaleem
95bea3371b
Add rubocop formatter (#176) 2023-04-22 11:53:13 +01:00
Mohsin Kaleem
93c11bf5e3
Add perltidy formatter (#175) 2023-04-22 11:48:38 +01:00
Mohsin Kaleem
2686e7b17d
Add html-tidy formatter (#173) 2023-04-22 11:44:44 +01:00
Mohsin Kaleem
568862dc84
Add cmake-format formatter (#172) 2023-04-22 11:41:37 +01:00
Mohsin Kaleem
5cb7156ef5
Add buildifier formatter (#171) 2023-04-22 11:38:15 +01:00
Mohsin Kaleem
85a2ab7e5e
Add beautysh formatter (#170) 2023-04-22 11:34:12 +01:00
Mohsin Kaleem
0290ae18cc
Add astyle formatter (#169) 2023-04-22 10:36:38 +01:00
Mohsin Kaleem
bc6b72c05d
Add asmfmt formatter (#168) 2023-04-22 10:26:49 +01:00
Mohsin Kaleem
49890c3762
Add gawk formatter (#187) 2023-04-20 14:33:53 +01:00
Mohsin Kaleem
6516abee4a
Add jq formatter (#174) 2023-04-20 13:50:03 +01:00
Mohsin Kaleem
3abce6308e
Require apheleia-core to detect changed formatters (#186)
Fixes PR builds.
2023-04-20 12:46:59 +01:00
Mohsin Kaleem
2d797a52e6 Move apheleia-formatters to apheleia-utils 2023-04-20 11:24:43 +01:00
Mohsin Kaleem
0474273496 Reorganise package requires to always provide apheleia 2023-04-20 11:24:43 +01:00
Mohsin Kaleem
ad728cfa76
Update existing formatters to use new formatter helper functions (#167) 2023-04-16 17:50:52 +01:00
Daniel Perez Alvarez
0a5a84ab03
docs: fix broken links in changelog (#184)
links for PRs #151 and #155 were broken in the changelog

use the rich view mode in github for better view of the result:

![image](https://user-images.githubusercontent.com/17787042/228892528-888ec39a-8681-4f57-952a-72f512f5d2cd.png)
2023-04-06 16:26:42 -07:00
Tomasz Hołubowicz
23c8b7d1ca
Add purs-tidy formatter (#182)
Hello!

I would like to add support for `purs-tidy` - PureScript formatter. 

Best wishes
alternateved
2023-03-29 14:35:02 -07:00
Mohsin Kaleem
edec1e61c8
Add various helper functions for defining formatters (#166) 2023-03-25 14:56:54 +00:00
Jay Barra
43ffed7890
Pretter svelte-mode (#178)
Adds support for `svelte-mode` using prettier.

Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2023-03-23 14:00:51 -07:00
Radon Rosborough
782db66457 Fix formatter tests 2023-03-17 18:53:52 -07:00
Mohsin Kaleem
26e436dfd0 Revert "Add various helper functions for defining formatters"
This reverts commit 1c607cf7a7.
2023-03-12 10:50:52 +00:00
Mohsin Kaleem
48e7233b42 Revert "Update existing formatters to use new utility functions"
This reverts commit ceaddebf39.
2023-03-12 10:50:49 +00:00
Mohsin Kaleem
a7800ac50b Revert "Update tests to fix failures from formatter definition changes"
This reverts commit e2062d612d.
2023-03-12 10:50:44 +00:00
Mohsin Kaleem
e2062d612d Update tests to fix failures from formatter definition changes 2023-03-12 10:45:14 +00:00
Mohsin Kaleem
ceaddebf39 Update existing formatters to use new utility functions 2023-03-12 10:45:10 +00:00
Mohsin Kaleem
1c607cf7a7 Add various helper functions for defining formatters 2023-03-12 10:34:28 +00:00
Mohsin Kaleem
3e93610387
Separate formatters definitions from core apheleia library (#161)
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.
2023-03-12 10:22:36 +00:00
Aleksandar Dimitrov
60f897a3a0
Fix ktlint (#159)
* 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
2023-03-11 15:46:17 -08:00
Radon Rosborough
ffa8d58651 Release version 3.2 2023-02-25 11:31:26 -08:00
Nikolai Prokoschenko
972b9906bf
Add formatter for Caddyfile (#154)
Add formatter for Caddyfile (#136)
2023-02-18 17:00:08 -08:00
Radon Rosborough
4f2e4cd925 [#156] Fix error when first arg is symbol 2023-02-15 19:01:53 -08:00