Add ktlint (#97)

* feat: add ktlint

* Apply suggestions from code review

Co-authored-by: Radon Rosborough <radon.neon@gmail.com>
This commit is contained in:
Ellis Kenyő 2022-05-13 17:23:57 +01:00 committed by GitHub
parent b5dbab53ea
commit 363d634c5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 0 deletions

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -0,0 +1,8 @@
class Test
{
fun test( v: String )
{
println(v)
}
}

View file

@ -0,0 +1,5 @@
class Test {
fun test(v: String) {
println(v)
}
}