summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorBartek thindil Jasicki <thindil@laeran.pl>2021-01-15 09:42:14 +0100
committerBartek thindil Jasicki <thindil@laeran.pl>2021-01-15 09:42:14 +0100
commit45a28383a2da3d28bdc5e7d3a0deb6365680980d (patch)
tree8c6a0d4f84a6534325e4854ef520c663eb3b81c7 /ale_linters
parent7b1ed2733e2b73a74149f300d5400225f535f490 (diff)
parent6fbdec8587ad918dccf13546418904d3f2c38a46 (diff)
downloadale-45a28383a2da3d28bdc5e7d3a0deb6365680980d.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/erlang/erlc.vim16
-rw-r--r--ale_linters/inko/inko.vim33
-rw-r--r--ale_linters/salt/salt_lint.vim3
3 files changed, 47 insertions, 5 deletions
diff --git a/ale_linters/erlang/erlc.vim b/ale_linters/erlang/erlc.vim
index a83bacc3..e78dc341 100644
--- a/ale_linters/erlang/erlc.vim
+++ b/ale_linters/erlang/erlc.vim
@@ -1,14 +1,22 @@
" Author: Magnus Ottenklinger - https://github.com/evnu
+let g:ale_erlang_erlc_executable = get(g:, 'ale_erlang_erlc_executable', 'erlc')
let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '')
+function! ale_linters#erlang#erlc#GetExecutable(buffer) abort
+ return ale#Var(a:buffer, 'erlang_erlc_executable')
+endfunction
+
function! ale_linters#erlang#erlc#GetCommand(buffer) abort
let l:output_file = ale#util#Tempname()
call ale#command#ManageFile(a:buffer, l:output_file)
- return 'erlc -o ' . ale#Escape(l:output_file)
- \ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
- \ . ' %t'
+ let l:command = ale#Escape(ale_linters#erlang#erlc#GetExecutable(a:buffer))
+ \ . ' -o ' . ale#Escape(l:output_file)
+ \ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
+ \ . ' %t'
+
+ return l:command
endfunction
function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
@@ -90,7 +98,7 @@ endfunction
call ale#linter#Define('erlang', {
\ 'name': 'erlc',
-\ 'executable': 'erlc',
+\ 'executable': function('ale_linters#erlang#erlc#GetExecutable'),
\ 'command': function('ale_linters#erlang#erlc#GetCommand'),
\ 'callback': 'ale_linters#erlang#erlc#Handle',
\})
diff --git a/ale_linters/inko/inko.vim b/ale_linters/inko/inko.vim
new file mode 100644
index 00000000..11558897
--- /dev/null
+++ b/ale_linters/inko/inko.vim
@@ -0,0 +1,33 @@
+" Author: Yorick Peterse <yorick@yorickpeterse.com>
+" Description: linting of Inko source code using the Inko compiler
+
+call ale#Set('inko_inko_executable', 'inko')
+
+function! ale_linters#inko#inko#GetCommand(buffer) abort
+ let l:include = ''
+
+ " Include the tests source directory, but only for test files.
+ if expand('#' . a:buffer . ':p') =~? '\vtests[/\\]test[/\\]'
+ let l:test_dir = ale#path#FindNearestDirectory(a:buffer, 'tests')
+
+ if isdirectory(l:test_dir)
+ let l:include = '--include ' . ale#Escape(l:test_dir)
+ endif
+ endif
+
+ " We use %s instead of %t so the compiler determines the correct module
+ " names for the file being edited. Not doing so may lead to errors in
+ " certain cases.
+ return '%e build --check --format=json'
+ \ . ale#Pad(l:include)
+ \ . ' %s'
+endfunction
+
+call ale#linter#Define('inko', {
+\ 'name': 'inko',
+\ 'executable': {b -> ale#Var(b, 'inko_inko_executable')},
+\ 'command': function('ale_linters#inko#inko#GetCommand'),
+\ 'callback': 'ale#handlers#inko#Handle',
+\ 'output_stream': 'stderr',
+\ 'lint_file': 1
+\})
diff --git a/ale_linters/salt/salt_lint.vim b/ale_linters/salt/salt_lint.vim
index d2027119..47f66d83 100644
--- a/ale_linters/salt/salt_lint.vim
+++ b/ale_linters/salt/salt_lint.vim
@@ -25,7 +25,8 @@ function! ale_linters#salt#salt_lint#Handle(buffer, lines) abort
endfunction
call ale#linter#Define('salt', {
-\ 'name': 'salt-lint',
+\ 'name': 'salt_lint',
+\ 'aliases': ['salt-lint'],
\ 'executable': {b -> ale#Var(b, 'salt_salt_lint_executable')},
\ 'command': function('ale_linters#salt#salt_lint#GetCommand'),
\ 'callback': 'ale_linters#salt#salt_lint#Handle'