Skip to content

Commit

Permalink
Add ktlint (#97)
Browse files Browse the repository at this point in the history
* feat: add ktlint

* Apply suggestions from code review

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
  • Loading branch information
elken and raxod502 authored May 13, 2022
1 parent b5dbab5 commit 363d634
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions apheleia.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions test/formatters/installers/ktlint.bash
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions test/formatters/samplecode/ktlint/in.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Test

{
fun test( v: String )
{
println(v)
}
}
5 changes: 5 additions & 0 deletions test/formatters/samplecode/ktlint/out.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Test {
fun test(v: String) {
println(v)
}
}

0 comments on commit 363d634

Please sign in to comment.