]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/ale_linters/inko/inko.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / ale_linters / inko / inko.vim
diff --git a/.vim/bundle/ale/ale_linters/inko/inko.vim b/.vim/bundle/ale/ale_linters/inko/inko.vim
new file mode 100644 (file)
index 0000000..1155889
--- /dev/null
@@ -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
+\})