diff options
| author | Ellis KenyĆ <elken@users.noreply.github.com> | 2022-05-13 17:23:57 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-13 09:23:57 -0700 |
| commit | 363d634c5c3d79983fb44d2238fcfdf24fbf81b2 (patch) | |
| tree | 5db5c28f0a5ec1154157f66067a93b52faedf5aa | |
| parent | b5dbab53eadf64529a0bfe217c7750f1d7d85fce (diff) | |
Add ktlint (#97)
* feat: add ktlint
* Apply suggestions from code review
Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | apheleia.el | 2 | ||||
| -rw-r--r-- | test/formatters/installers/ktlint.bash | 4 | ||||
| -rw-r--r-- | test/formatters/samplecode/ktlint/in.kt | 8 | ||||
| -rw-r--r-- | test/formatters/samplecode/ktlint/out.kt | 5 |
5 files changed, 20 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8694fb4..0f601ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog]. * [dart-format](https://dart.dev/tools/dart-format) for Dart ([#89]). * [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) for PHP ([#87]). +* [ktlint](https://github.com/pinterest/ktlint) for Kotlin ([#95]). ### Features * Support remote files and buffers that were opened through TRAMP diff --git a/apheleia.el b/apheleia.el index 8dc3696..c71121c 100644 --- a/apheleia.el +++ b/apheleia.el @@ -927,6 +927,7 @@ being run, for diagnostic purposes." (gofmt . ("gofmt")) (google-java-format . ("google-java-format" "-")) (isort . ("isort" "-")) + (ktlint . ("ktlint" "--stdin" "-F")) (latexindent . ("latexindent" "--logfile=/dev/null")) (mix-format . ("mix" "format" "-")) (ocamlformat . ("ocamlformat" "-" "--name" filepath @@ -1059,6 +1060,7 @@ function: %s" command))) (js3-mode . prettier) (js-mode . prettier) (json-mode . prettier) + (kotlin-mode . ktlint) (latex-mode . latexindent) (LaTeX-mode . latexindent) (python-mode . black) diff --git a/test/formatters/installers/ktlint.bash b/test/formatters/installers/ktlint.bash new file mode 100644 index 0000000..347a816 --- /dev/null +++ b/test/formatters/installers/ktlint.bash @@ -0,0 +1,4 @@ +ver="$(latest_release pinterest/ktlint)" +apt-get install -y default-jre +wget "https://github.com/pinterest/ktlint/releases/download/${ver}/ktlint" -O /usr/local/bin/ktlint +chmod +x /usr/local/bin/ktlint diff --git a/test/formatters/samplecode/ktlint/in.kt b/test/formatters/samplecode/ktlint/in.kt new file mode 100644 index 0000000..deacc25 --- /dev/null +++ b/test/formatters/samplecode/ktlint/in.kt @@ -0,0 +1,8 @@ +class Test + +{ +fun test( v: String ) +{ + println(v) +} +} diff --git a/test/formatters/samplecode/ktlint/out.kt b/test/formatters/samplecode/ktlint/out.kt new file mode 100644 index 0000000..c1838fb --- /dev/null +++ b/test/formatters/samplecode/ktlint/out.kt @@ -0,0 +1,5 @@ +class Test { + fun test(v: String) { + println(v) + } +} |
