aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2026-04-14Add OpenTofu, use by default for Terraform (#391)Radon Rosborough
Seems fairly straightforward to me, Terraform is no longer open-source, OpenTofu is the compatible open-source successor, similar to the Redis/Valkey situation. Of course, if someone still prefers to use Terraform instead, they can easily customize using: ```tf (setf (alist-get 'terraform-mode apheleia-mode-alist) 'terraform) ``` We don't have a mechanism for allowing multiple formatters to be registered for the same major mode, where later ones could be used if earlier ones are not installed. That might be a nice addition.
2026-01-20Remove --no-doc argument from yq-yaml formatter (#386)Andreas Kurth
The --no-doc argument removes existing document separators (---) from yaml files. It is perfectly valid and common practice to use multiple documents within a single file, e.g. in the kubernetes universe. Formatting such files with --no-doc breaks their validity. See also the prettier-yaml test, which preserves the document separator, too.
2025-12-13Add support for oxfmt formatter (#382)Mike Olson
## Summary - Add oxfmt (Oxc Formatter) as a new formatter option for JavaScript and TypeScript files ## Details [Oxfmt](https://oxc.rs/docs/guide/usage/formatter) is a Rust-powered, Prettier-compatible code formatter from the Oxc project. It's currently in alpha but offers significant performance improvements (30x+ faster than Prettier). Key points: - Uses `inplace` mode since oxfmt doesn't support stdin/stdout - Works with all common JS/TS extensions (.js, .jsx, .mjs, .cjs, .ts, .tsx, .mts) - Not added to `apheleia-mode-alist` - users can opt-in by setting `apheleia-formatter` to `oxfmt` - Defaults are already sensible: 2-space indent, printWidth 100, no tabs Example usage: ```elisp (setf (alist-get 'oxfmt apheleia-formatters) '("apheleia-npx" "oxfmt" inplace)) ;; To use for JS/TS files: (setq-default apheleia-formatter 'oxfmt) ;; Or per-mode: (setf (alist-get 'typescript-ts-mode apheleia-mode-alist) 'oxfmt) ```
2025-12-10Pass --force-exclusion to rubocop (#380)Ibrahim Awwal
This make rubocop obey exclusions from config files. Otherwise, even if a file is excluded from in .rubocop.yml, apheleia will still format it. See https://docs.rubocop.org/rubocop/usage/basic_usage.html#command-line-flags
2025-12-01Fix shfmt when used with apheleia-formatters-respect-indent-level (#379)Tej Chajed
The shfmt formatter produced an invalid command invocation. The symptom was an error: `eval: Invalid function: "-i"` I couldn't figure out how to splice the list in correctly but `--indent=` can be passed as one argument. --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2025-11-28Add support for bibtex-mode (#294)Vu Quoc Huy
Add support for `bibtex-mode` using emacs native function `bibtex-reformat`.
2025-11-11Add styleR for ess-r-mode (#377)Martin Edström
Hi! My first time adding a formatter, please let me know if I missed anything. Some things I'm unclear about: 1. How to fail gracefully when [styleR](https://styler.r-lib.org/) package is absent from the system 2. Whether the formatter should be named `ess-r` or something more general like `rlang` ## Test case FYI, there are loads of tests to pick from on https://github.com/r-lib/styler/tree/main/tests/testthat. I picked [unindention/mixed-in.R](https://github.com/r-lib/styler/blob/main/tests/testthat/unindention/mixed-in.R), but oddly, the output [unindention/mixed-out.R](https://github.com/r-lib/styler/blob/main/tests/testthat/unindention/mixed-out.R) isn't quite the same as we got! I don't know if that's an upstream issue, or that upstream changed style since that test was written, or that perhaps the file is meant to be concatenated into something else.
2025-07-24Add taplo for formatting TOML files (#373)Jimmy Yuen Ho Wong
Taplo is a very popular formatter and linter for TOML. https://github.com/tamasfe/taplo
2025-07-20Add csharpier for C# (#371)Radon Rosborough
Unfortunately, I have to write some C#
2025-06-11Add support for `hurlfmt` to format `hurl` files (#365)Derek Passen
2025-05-19feat: add nomad formatter (#361)Matus Goljer
This is a more specific formatter than `hclfmt` for nomad files.
2025-05-19Fix moving point (#363)Trevor Murphy
When replacing text, calculate the cursor offset relative to the start of the replacement, not the end of the text-to-be-added. * test/integration/apheleia-it.el (supports-inserting-whitespace): New test case * apheleia-rcs.el (apheleia--apply-rcs-patch): Go to start of deletion text before calculating offsets
2025-03-08Fix patches moving a line to the top of the file. (#353)Guillaume Brunerie
RCS patches containing a 'a0' instruction are not handled properly. This pull request fixes the handling of 'a0' instructions and adds an integration test that fails otherwise. Fixes #299.
2025-01-21Add support for podman (#343)Radon Rosborough
Helps to test #331. No reason that docker should work and podman shouldn't. ![image](https://github.com/user-attachments/assets/598c914d-09ca-4124-af43-49d52c230b43)
2025-01-21Add support for `cljstyle` for Clojure code (#333)Derek Passen
Add support for [cljstyle](https://github.com/greglook/cljstyle) Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2025-01-19feat: add gdformat formatter for godot/gdscript (#342)Daniel Perez Alvarez
Add [gdformat](https://github.com/Scony/godot-gdscript-toolkit?tab=readme-ov-file#formatting-with-gdformat-more) for godot gdscript files See - https://godotengine.org/ - https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html - https://github.com/Scony/godot-gdscript-toolkit --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2025-01-19feat: add prettier-json-stringify formatter (#183)Daniel Perez Alvarez
Adds a new formatter for prettier `prettier-json-stringify` which uses prettier `json-stringify` parser. `json-stringify` parser is used by prettier for formatting package.json files
2025-01-18feat: add biome formatter (#339)Daniel Perez Alvarez
See https://biomejs.dev/ Alternative formatter to `prettier` closes https://github.com/radian-software/apheleia/issues/323
2024-10-18Add vfmt (#324)elogir
https://github.com/vlang/v --------- Co-authored-by: Raphael Nahoum <raphaelnahoum@Flrians-MBP.localdomain> Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2024-10-17support gleam language (#325)nohz.afk
support gleam language --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2024-10-17Add zig fmt support (#327)hgranthorner
Add support for the zig programming language using `zig fmt` for `zig-mode` and `zig-ts-mode`. --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2024-10-05Add snakefmt (#307)Edmund Miller
https://github.com/snakemake/snakefmt --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2024-10-05Fix commentRadon Rosborough
2024-09-25Use --stdin-filename conditionally for mix-format (#322)Radon Rosborough
Closes #319 because this does the same thing but it transparently works for all versions of mix-format.
2024-09-21[#312] Fix Ormolu installation and invocation (#321)Radon Rosborough
Closes #312. The installation script was failing due to some Cabal bullshit that I don't even want to know the reason for, probably triggered by new package versions coming available, so I switched to upstream binaries. Applied the suggested fix from #312 for a new command-line option which has become required. Also set Ormolu as the default Haskell formatter instead of Brittany because that is what the Brittany dev recommends (see again #312).
2024-09-21Add ocp-indent as a formatter (#306)Puneeth Chaganti
ocp-indent allows indenting even partially compiling OCaml code, while ocamlformat requires the code to compile correctly. Also, Doom Emacs uses ocp-indent when ocamlformat's configuration file is not found, and not having an ocp-indent formatter gives an error. <!-- 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>
2024-09-02Add support for typstyle (#313)dalu
Formatter for typst https://github.com/Enter-tainer/typstyle Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2024-09-02Fix `apheleia-npx` in Yarn PnP projects (#301)Xandor Schiefer
* `apheleia-npx` would use an incorrect path for the Yarn PnP ESM loader. * `apheleia-npx` did not correctly guard against word splitting. * `apheleia-npx` was sometimes not able to find formatters in a Yarn PnP project if there was also a node_modules folder at the root of the project. Unfortunately, many tools (including [Prettier](https://github.com/prettier/prettier/issues/13032)) will create a cache folder in `node_modules` even in Yarn PnP projects. The presence of any `node_modules` folders are irrelevant when a `.pnp.cjs` file is present. --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2024-05-17[#302] User option: apheleia-mode-predicates (#303)Radon Rosborough
For https://github.com/radian-software/apheleia/issues/302. Not tested yet. Going to add unit tests before merging.
2024-04-13Add integration tests (#204)Radon Rosborough
Work in progress, some of the code is cribbed from https://github.com/radian-software/dumbparens
2024-03-30Prevent null issues when strings are unequal (#290)Ellis Kenyő
In the case where s2 is larger than s1, this errors because the index is out of range. A good testcase is the below ```lisp (apheleia--align-point " <div class=\"left-[40rem] fixed inset-y-0 right-0 z-0 hidden lg:block xl:left-[50rem]\">\n <svg\n" "<div class=\"left-[40rem] fixed inset-y-0 right-0 z-0 hidden lg:block xl:left-[50rem]\">\n <svg" 6) ``` If I've implemented the indexing wrong, do let me know but this seems to work just fine now for `mix` (the formatter that triggered this) --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2024-03-22Add support for dhall format (#284)Julio César
Adds a new formatter `dhall-format` used for [dhall](https://dhall-lang.org/). --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2024-02-08add support for pyang (#282)sgherdao
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>
2024-01-12Add `ruff-isort` formatter (#279)Chris Rose
`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>
2024-01-12Add support for `treefmt` (#280)Terje Larsen
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.
2023-12-21Add ruby-syntax-tree format support (#224)Nolan
Add [ruby-syntax-tree](https://github.com/ruby-syntax-tree/syntax_tree) as an available formatter. Include support for finding a [`.streerc` file](https://github.com/ruby-syntax-tree/syntax_tree#configuration). --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2023-12-14Add `docformatter` which formats Python docstrings to PEP 257 (#267)Michael Eliachevitch
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>
2023-12-14Add support for `dprint` (#249)Ville Skyttä
https://dprint.dev --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2023-12-14Add support for JSON with `python3 -m json.tool` (#257)Ville Skyttä
https://docs.python.org/3/library/json.html#module-json.tool
2023-12-14 Add support for `cljfmt` (#271)dalu
2023-11-29Add denofmt (#264)dalu
2023-11-28Add support for Robot Framework files with `robotidy` (#263)Ville Skyttä
2023-11-26Add js-beautify based formatters (#229)Mohsin Kaleem
2023-11-23Add support for SQL using `pgformatter` (#247)Abdelhak Bougouffa
Add support for [`pgFormatter`](https://github.com/darold/pgFormatter) for `sql-mode`. <!-- To expedite the pull request process, please see the contributor guide for my projects: <https://github.com/raxod502/contributor-guide> -->
2023-11-23Spelling and grammar fixes (#248)Ville Skyttä
2023-11-23Add support for `xmllint` (#251)Ville Skyttä
<!-- 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>
2023-11-23Add support for `yq` (#250)Ville Skyttä
<!-- To expedite the pull request process, please see the contributor guide for my projects: <https://github.com/raxod502/contributor-guide> -->
2023-11-11Small fixes (#245)Radon Rosborough
Some things I noticed from https://github.com/radian-software/apheleia/pull/242 but didn't want to patch in place because CI had passed already.
2023-11-11Bump test environment to Ubuntu 22.04 (#242)Ed Slocomb
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.
2023-11-05Add support for formatters locally installed via yarn 2+ pnp mode (#200)Ed Slocomb
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>