summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2019-01-27 15:55:13 +0000
committerGitHub <noreply@github.com>2019-01-27 15:55:13 +0000
commit08d3523962927d1360b87ac147a29a242c31e7b0 (patch)
treef1813128e1038339d4eed657ec6604fe92792297 /ale_linters
parent3c38fdb1bb3625bcb222cfce16acd7db360ef413 (diff)
parentbd1e639681a9154315251c63cb704186ed08ce13 (diff)
downloadale-08d3523962927d1360b87ac147a29a242c31e7b0.zip
Merge pull request #2228 from Nomad145/ktlint
Add ktlint Fixer Support
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/kotlin/ktlint.vim48
1 files changed, 2 insertions, 46 deletions
diff --git a/ale_linters/kotlin/ktlint.vim b/ale_linters/kotlin/ktlint.vim
index f474e845..b8920aa7 100644
--- a/ale_linters/kotlin/ktlint.vim
+++ b/ale_linters/kotlin/ktlint.vim
@@ -1,54 +1,10 @@
" Author: Francis Agyapong <francisagyapong2@gmail.com>
" Description: Lint kotlin files using ktlint
-call ale#Set('kotlin_ktlint_executable', 'ktlint')
-call ale#Set('kotlin_ktlint_rulesets', [])
-call ale#Set('kotlin_ktlint_format', 0)
-
-
-function! ale_linters#kotlin#ktlint#GetCommand(buffer) abort
- let l:executable = ale#Var(a:buffer, 'kotlin_ktlint_executable')
- let l:file_path = expand('#' . a:buffer . ':p')
- let l:options = ''
-
- " Formmatted content written to original file, not sure how to handle
- " if ale#Var(a:buffer, 'kotlin_ktlint_format')
- " let l:options = l:options . ' --format'
- " endif
-
- for l:ruleset in ale#Var(a:buffer, 'kotlin_ktlint_rulesets')
- let l:options = l:options . ' --ruleset ' . l:ruleset
- endfor
-
- return l:executable . ' ' . l:options . ' ' . l:file_path
-endfunction
-
-function! ale_linters#kotlin#ktlint#Handle(buffer, lines) abort
- let l:message_pattern = '^\(.*\):\([0-9]\+\):\([0-9]\+\):\s\+\(.*\)'
- let l:output = []
-
- for l:match in ale#util#GetMatches(a:lines, l:message_pattern)
- let l:line = l:match[2] + 0
- let l:column = l:match[3] + 0
- let l:text = l:match[4]
-
- let l:type = l:text =~? 'not a valid kotlin file' ? 'E' : 'W'
-
- call add(l:output, {
- \ 'lnum': l:line,
- \ 'col': l:column,
- \ 'text': l:text,
- \ 'type': l:type
- \})
- endfor
-
- return l:output
-endfunction
-
call ale#linter#Define('kotlin', {
\ 'name': 'ktlint',
\ 'executable': 'ktlint',
-\ 'command_callback': 'ale_linters#kotlin#ktlint#GetCommand',
-\ 'callback': 'ale_linters#kotlin#ktlint#Handle',
+\ 'command_callback': 'ale#handlers#ktlint#GetCommand',
+\ 'callback': 'ale#handlers#ktlint#Handle',
\ 'lint_file': 1
\})