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
This commit is contained in:
Aleksandar Dimitrov 2023-03-12 00:46:17 +01:00 committed by GitHub
parent ffa8d58651
commit 60f897a3a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog]. The format is based on [Keep a Changelog].
## Unreleased
### Bugs fixed
* `ktlint` would emit log messages into its stdout when formatting,
and these would get spliced into the source file. This has been fixed
by suppressing all logs from `ktlint`.
## 3.2 (released 2023-02-25) ## 3.2 (released 2023-02-25)
### Features ### Features
* You can use `apheleia-inhibit` as a file-local variable to disable * You can use `apheleia-inhibit` as a file-local variable to disable

View file

@ -961,7 +961,7 @@ being run, for diagnostic purposes."
(google-java-format . ("google-java-format" "-")) (google-java-format . ("google-java-format" "-"))
(isort . ("isort" "-")) (isort . ("isort" "-"))
(lisp-indent . apheleia-indent-lisp-buffer) (lisp-indent . apheleia-indent-lisp-buffer)
(ktlint . ("ktlint" "--stdin" "-F")) (ktlint . ("ktlint" "--log-level=none" "--stdin" "-F"))
(latexindent . ("latexindent" "--logfile=/dev/null")) (latexindent . ("latexindent" "--logfile=/dev/null"))
(mix-format . ("mix" "format" "-")) (mix-format . ("mix" "format" "-"))
(nixfmt . ("nixfmt")) (nixfmt . ("nixfmt"))