Merge pull request #3119 from hsanson/2269-ktlint-stdin-support

Fix 2269 - use ktlint stdin.
This commit is contained in:
w0rp 2020-07-21 12:45:26 +01:00 committed by GitHub
commit 70ab831001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 8 deletions

View File

@ -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'
\})

View File

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

View File

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

View File

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