summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2020-07-21 12:45:26 +0100
committerGitHub <noreply@github.com>2020-07-21 12:45:26 +0100
commit70ab831001dbe806fc5af3f33727f1fa32e3ff13 (patch)
treed9b9e252bb0f4085c17b6562b9afb9ba59254a9c
parentc1c3bd922791f0e37ede679c99757c16e3e1b8a9 (diff)
parent5035281cb978d8fe6de7d91c1973a19f1a96bb3c (diff)
downloadale-70ab831001dbe806fc5af3f33727f1fa32e3ff13.zip
Merge pull request #3119 from hsanson/2269-ktlint-stdin-support
Fix 2269 - use ktlint stdin.
-rw-r--r--ale_linters/kotlin/ktlint.vim2
-rw-r--r--autoload/ale/fixers/ktlint.vim3
-rw-r--r--autoload/ale/handlers/ktlint.vim2
-rw-r--r--test/fixers/test_ktlint_fixer_callback.vader6
4 files changed, 5 insertions, 8 deletions
diff --git a/ale_linters/kotlin/ktlint.vim b/ale_linters/kotlin/ktlint.vim
index f0384005..0bb64b19 100644
--- a/ale_linters/kotlin/ktlint.vim
+++ b/ale_linters/kotlin/ktlint.vim
@@ -6,5 +6,5 @@ call ale#linter#Define('kotlin', {
\ 'executable': 'ktlint',
\ 'command': function('ale#handlers#ktlint#GetCommand'),
\ 'callback': 'ale#handlers#ktlint#Handle',
-\ 'lint_file': 1
+\ 'output_stream': 'stderr'
\})
diff --git a/autoload/ale/fixers/ktlint.vim b/autoload/ale/fixers/ktlint.vim
index cb975d6c..64d1340d 100644
--- a/autoload/ale/fixers/ktlint.vim
+++ b/autoload/ale/fixers/ktlint.vim
@@ -3,7 +3,6 @@
function! ale#fixers#ktlint#Fix(buffer) abort
return {
- \ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format',
- \ 'read_temporary_file': 1,
+ \ 'command': ale#handlers#ktlint#GetCommand(a:buffer) . ' --format'
\}
endfunction
diff --git a/autoload/ale/handlers/ktlint.vim b/autoload/ale/handlers/ktlint.vim
index ad999485..77e7ab66 100644
--- a/autoload/ale/handlers/ktlint.vim
+++ b/autoload/ale/handlers/ktlint.vim
@@ -13,7 +13,7 @@ function! ale#handlers#ktlint#GetCommand(buffer) abort
return ale#Escape(l:executable)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . (empty(l:rulesets) ? '' : ' ' . l:rulesets)
- \ . ' %t'
+ \ . ' --stdin'
endfunction
function! ale#handlers#ktlint#GetRulesets(buffer) abort
diff --git a/test/fixers/test_ktlint_fixer_callback.vader b/test/fixers/test_ktlint_fixer_callback.vader
index 47b37788..ba01a409 100644
--- a/test/fixers/test_ktlint_fixer_callback.vader
+++ b/test/fixers/test_ktlint_fixer_callback.vader
@@ -21,9 +21,8 @@ Execute(The ktlint callback should return the correct default values):
AssertEqual
\ {
\ 'command': ale#Escape('xxxinvalid')
- \ . ' %t'
+ \ . ' --stdin'
\ . ' --format',
- \ 'read_temporary_file': 1,
\ },
\ ale#fixers#ktlint#Fix(bufnr(''))
@@ -37,8 +36,7 @@ Execute(The ktlint callback should include custom ktlint options):
\ 'command': ale#Escape('xxxinvalid')
\ . ' ' . g:ale_kotlin_ktlint_options
\ . ' --ruleset /path/to/custom/ruleset.jar'
- \ . ' %t'
+ \ . ' --stdin'
\ . ' --format',
- \ 'read_temporary_file': 1,
\ },
\ ale#fixers#ktlint#Fix(bufnr(''))