diff options
author | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-08-29 10:42:25 +0200 |
---|---|---|
committer | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-08-29 10:42:25 +0200 |
commit | 0de847a8e1793b597ba0a73ae8e20797a5fce920 (patch) | |
tree | 6f465b404af38ff25dddde94e052bdfa0a3a38c8 /ale_linters | |
parent | 62f07d820c2b474216657bd43a3a919469c9584f (diff) | |
parent | 7d4ce4e6aa960a6052a16d90322566d6f4fddb7c (diff) | |
download | ale-0de847a8e1793b597ba0a73ae8e20797a5fce920.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/ada/gcc.vim | 2 | ||||
-rw-r--r-- | ale_linters/asm/gcc.vim | 2 | ||||
-rw-r--r-- | ale_linters/c/cc.vim | 2 | ||||
-rw-r--r-- | ale_linters/cpp/cc.vim | 2 | ||||
-rw-r--r-- | ale_linters/cuda/nvcc.vim | 3 | ||||
-rw-r--r-- | ale_linters/eruby/ruumba.vim | 2 | ||||
-rw-r--r-- | ale_linters/go/gofmt.vim | 1 | ||||
-rw-r--r-- | ale_linters/nasm/nasm.vim | 3 | ||||
-rw-r--r-- | ale_linters/objc/clang.vim | 2 | ||||
-rw-r--r-- | ale_linters/objcpp/clang.vim | 2 | ||||
-rw-r--r-- | ale_linters/pyrex/cython.vim | 4 | ||||
-rw-r--r-- | ale_linters/python/pydocstyle.vim | 8 | ||||
-rw-r--r-- | ale_linters/ruby/rubocop.vim | 2 | ||||
-rw-r--r-- | ale_linters/ruby/standardrb.vim | 2 | ||||
-rw-r--r-- | ale_linters/sql/sqllint.vim | 33 |
15 files changed, 47 insertions, 23 deletions
diff --git a/ale_linters/ada/gcc.vim b/ale_linters/ada/gcc.vim index 87496b81..5afc9ae3 100644 --- a/ale_linters/ada/gcc.vim +++ b/ale_linters/ada/gcc.vim @@ -18,7 +18,7 @@ function! ale_linters#ada#gcc#GetCommand(buffer) abort " -gnatc: Check syntax and semantics only (no code generation attempted) return '%e -x ada -c -gnatc' \ . ' -o ' . ale#Escape(l:out_file) - \ . ' -I ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . ' -I %s:h' \ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options')) \ . ' %t' endfunction diff --git a/ale_linters/asm/gcc.vim b/ale_linters/asm/gcc.vim index eecab6ef..cda38923 100644 --- a/ale_linters/asm/gcc.vim +++ b/ale_linters/asm/gcc.vim @@ -9,7 +9,7 @@ function! ale_linters#asm#gcc#GetCommand(buffer) abort " -fsyntax-only doesn't catch everything. return '%e -x assembler' \ . ' -o ' . g:ale#util#nul_file - \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -' endfunction diff --git a/ale_linters/c/cc.vim b/ale_linters/c/cc.vim index 6d920ab0..5655fbf7 100644 --- a/ale_linters/c/cc.vim +++ b/ale_linters/c/cc.vim @@ -38,7 +38,7 @@ function! ale_linters#c#cc#GetCommand(buffer, output) abort " -fsyntax-only doesn't catch everything. return '%e -S -x c' \ . ' -o ' . g:ale#util#nul_file - \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . ' -iquote %s:h' \ . ale#Pad(l:cflags) \ . ale#Pad(l:ale_flags) . ' -' endfunction diff --git a/ale_linters/cpp/cc.vim b/ale_linters/cpp/cc.vim index eed3898f..ffb8f068 100644 --- a/ale_linters/cpp/cc.vim +++ b/ale_linters/cpp/cc.vim @@ -38,7 +38,7 @@ function! ale_linters#cpp#cc#GetCommand(buffer, output) abort " -fsyntax-only doesn't catch everything. return '%e -S -x c++' \ . ' -o ' . g:ale#util#nul_file - \ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . ' -iquote %s:h' \ . ale#Pad(l:cflags) \ . ale#Pad(l:ale_flags) . ' -' endfunction diff --git a/ale_linters/cuda/nvcc.vim b/ale_linters/cuda/nvcc.vim index f3af07b6..2734f6ec 100644 --- a/ale_linters/cuda/nvcc.vim +++ b/ale_linters/cuda/nvcc.vim @@ -5,9 +5,6 @@ call ale#Set('cuda_nvcc_executable', 'nvcc') call ale#Set('cuda_nvcc_options', '-std=c++11') function! ale_linters#cuda#nvcc#GetCommand(buffer) abort - " Unused: use ale#util#nul_file - " let l:output_file = ale#util#Tempname() . '.ii' - " call ale#command#ManageFile(a:buffer, l:output_file) return '%e -cuda' \ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))) \ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options')) diff --git a/ale_linters/eruby/ruumba.vim b/ale_linters/eruby/ruumba.vim index 2e84acf7..f415f1ab 100644 --- a/ale_linters/eruby/ruumba.vim +++ b/ale_linters/eruby/ruumba.vim @@ -11,7 +11,7 @@ function! ale_linters#eruby#ruumba#GetCommand(buffer) abort return ale#ruby#EscapeExecutable(l:executable, 'ruumba') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'eruby_ruumba_options') - \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) + \ . ' --stdin %s' endfunction function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort diff --git a/ale_linters/go/gofmt.vim b/ale_linters/go/gofmt.vim index a233b422..b313f9ca 100644 --- a/ale_linters/go/gofmt.vim +++ b/ale_linters/go/gofmt.vim @@ -6,7 +6,6 @@ function! ale_linters#go#gofmt#GetCommand(buffer) abort \ . '%e -e %t' endfunction - call ale#linter#Define('go', { \ 'name': 'gofmt', \ 'output_stream': 'stderr', diff --git a/ale_linters/nasm/nasm.vim b/ale_linters/nasm/nasm.vim index 347abc1b..c4f53629 100644 --- a/ale_linters/nasm/nasm.vim +++ b/ale_linters/nasm/nasm.vim @@ -7,10 +7,9 @@ call ale#Set('nasm_nasm_options', '') function! ale_linters#nasm#nasm#GetCommand(buffer) abort " Note that NASM requires a trailing slash for the -I option. let l:separator = has('win32') ? '\' : '/' - let l:path = fnamemodify(bufname(a:buffer), ':p:h') . l:separator let l:output_null = has('win32') ? 'NUL' : '/dev/null' - return '%e -X gnu -I ' . ale#Escape(l:path) + return '%e -X gnu -I %s:h' . l:separator \ . ale#Pad(ale#Var(a:buffer, 'nasm_nasm_options')) \ . ' %s' \ . ' -o ' . l:output_null diff --git a/ale_linters/objc/clang.vim b/ale_linters/objc/clang.vim index 7873dccd..cafb97db 100644 --- a/ale_linters/objc/clang.vim +++ b/ale_linters/objc/clang.vim @@ -10,7 +10,7 @@ function! ale_linters#objc#clang#GetCommand(buffer) abort " -iquote with the directory the file is in makes #include work for " headers in the same directory. return 'clang -S -x objective-c -fsyntax-only ' - \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'objc_clang_options') . ' -' endfunction diff --git a/ale_linters/objcpp/clang.vim b/ale_linters/objcpp/clang.vim index 4dbe55b3..35a40c6f 100644 --- a/ale_linters/objcpp/clang.vim +++ b/ale_linters/objcpp/clang.vim @@ -10,7 +10,7 @@ function! ale_linters#objcpp#clang#GetCommand(buffer) abort " -iquote with the directory the file is in makes #include work for " headers in the same directory. return 'clang++ -S -x objective-c++ -fsyntax-only ' - \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) + \ . '-iquote %s:h' \ . ' ' . ale#Var(a:buffer, 'objcpp_clang_options') . ' -' endfunction diff --git a/ale_linters/pyrex/cython.vim b/ale_linters/pyrex/cython.vim index 84382ba1..247c3060 100644 --- a/ale_linters/pyrex/cython.vim +++ b/ale_linters/pyrex/cython.vim @@ -6,9 +6,7 @@ call ale#Set('pyrex_cython_executable', 'cython') call ale#Set('pyrex_cython_options', '--warning-extra') function! ale_linters#pyrex#cython#GetCommand(buffer) abort - let l:local_dir = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) - - return '%e --working ' . l:local_dir . ' --include-dir ' . l:local_dir + return '%e --working %s:h --include-dir %s:h' \ . ale#Pad(ale#Var(a:buffer, 'pyrex_cython_options')) \ . ' --output-file ' . g:ale#util#nul_file . ' %t' endfunction diff --git a/ale_linters/python/pydocstyle.vim b/ale_linters/python/pydocstyle.vim index 3901db4d..69ae3807 100644 --- a/ale_linters/python/pydocstyle.vim +++ b/ale_linters/python/pydocstyle.vim @@ -16,17 +16,15 @@ function! ale_linters#python#pydocstyle#GetExecutable(buffer) abort endfunction function! ale_linters#python#pydocstyle#GetCommand(buffer) abort - let l:dir = fnamemodify(bufname(a:buffer), ':p:h') let l:executable = ale_linters#python#pydocstyle#GetExecutable(a:buffer) - let l:exec_args = l:executable =~? 'pipenv$' \ ? ' run pydocstyle' \ : '' - return ale#path#CdString(l:dir) + return ale#path#BufferCdString(a:buffer) \ . ale#Escape(l:executable) . l:exec_args - \ . ' ' . ale#Var(a:buffer, 'python_pydocstyle_options') - \ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:t')) + \ . ale#Pad(ale#Var(a:buffer, 'python_pydocstyle_options')) + \ . ' %s:t' endfunction function! ale_linters#python#pydocstyle#Handle(buffer, lines) abort diff --git a/ale_linters/ruby/rubocop.vim b/ale_linters/ruby/rubocop.vim index 410ed0ea..483806a6 100644 --- a/ale_linters/ruby/rubocop.vim +++ b/ale_linters/ruby/rubocop.vim @@ -10,7 +10,7 @@ function! ale_linters#ruby#rubocop#GetCommand(buffer) abort return ale#ruby#EscapeExecutable(l:executable, 'rubocop') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'ruby_rubocop_options') - \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) + \ . ' --stdin %s' endfunction function! ale_linters#ruby#rubocop#GetType(severity) abort diff --git a/ale_linters/ruby/standardrb.vim b/ale_linters/ruby/standardrb.vim index f751e803..6ccfd2d6 100644 --- a/ale_linters/ruby/standardrb.vim +++ b/ale_linters/ruby/standardrb.vim @@ -11,7 +11,7 @@ function! ale_linters#ruby#standardrb#GetCommand(buffer) abort return ale#ruby#EscapeExecutable(l:executable, 'standardrb') \ . ' --format json --force-exclusion ' \ . ale#Var(a:buffer, 'ruby_standardrb_options') - \ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p')) + \ . ' --stdin %s' endfunction " standardrb is based on RuboCop so the callback is the same diff --git a/ale_linters/sql/sqllint.vim b/ale_linters/sql/sqllint.vim new file mode 100644 index 00000000..78396fe9 --- /dev/null +++ b/ale_linters/sql/sqllint.vim @@ -0,0 +1,33 @@ +" ale_linters/sql/sqllint.vim +" Author: Joe Reynolds <joereynolds952@gmail.co> +" Description: sql-lint for SQL files. +" sql-lint can be found at +" https://www.npmjs.com/package/sql-lint +" https://github.com/joereynolds/sql-lint + +function! ale_linters#sql#sqllint#Handle(buffer, lines) abort + " Matches patterns like the following: + " + " stdin:1 [ER_NO_DB_ERROR] No database selected + let l:pattern = '\v^[^:]+:(\d+) (.*)' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'col': l:match[2] + 0, + \ 'type': l:match[3][0], + \ 'text': l:match[0], + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('sql', { +\ 'name': 'sqllint', +\ 'aliases': ['sql-lint'], +\ 'executable': 'sql-lint', +\ 'command': 'sql-lint', +\ 'callback': 'ale_linters#sql#sqllint#Handle', +\}) |