aboutsummaryrefslogtreecommitdiff
path: root/test/formatters/samplecode
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-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-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-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-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-04Add support for the ruff python formatter (#236)Chris Rose
This adds support, but does not make it the default Fixes: #233 --------- Co-authored-by: Radon Rosborough <radon@intuitiveexplanations.com>
2023-10-29Use hclfmt to format hashicorp HCL files. (#231)Dhananjay Balan
Add formatter `hclfmt` for Hashicorp Configuration Langauge (HCL).
2023-10-06Add ormolu and fourmolu, remove brittany (#221)Ed Slocomb
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-08-11Add ruby-standard formatter (#201)Ed Slocomb
There are *so many* opinionated no-config ruby formatters ;)
2023-05-27Add `yapf` formatter (#196)Semen
<!-- To expedite the pull request process, please see the contributor guide for my projects: <https://github.com/raxod502/contributor-guide> -->
2023-04-22Add rufo formatter (#177)Mohsin Kaleem
2023-04-22Add rubocop formatter (#176)Mohsin Kaleem
2023-04-22Add perltidy formatter (#175)Mohsin Kaleem
2023-04-22Add html-tidy formatter (#173)Mohsin Kaleem
2023-04-22Add cmake-format formatter (#172)Mohsin Kaleem
2023-04-22Add buildifier formatter (#171)Mohsin Kaleem