summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-01-13 23:54:06 +0900
committerGitHub <noreply@github.com>2021-01-13 23:54:06 +0900
commit97ce2423b04745d5c7588385ddbd75be9ef846d4 (patch)
tree57268e48efdc93900cb41bb2194e1128b6d26c0e /ale_linters
parent7b187af10abd2f8984e1ca061c30244a8a0bdb60 (diff)
parent8375ee2766c4d69462b8c883ddf76d58a86891e4 (diff)
downloadale-97ce2423b04745d5c7588385ddbd75be9ef846d4.zip
Merge pull request #3494 from YorickPeterse/master
Add linter for Inko
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/inko/inko.vim33
1 files changed, 33 insertions, 0 deletions
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
+\})