Compare commits

...

6 Commits

Author SHA1 Message Date
w0rp 0c6370f41a
Fix #2276 - Replace a potentially infinite loop for hie 2019-02-07 16:26:04 +00:00
w0rp 0ed3fbc596
Fix #2263 - detailed Flow errors should show the original message 2019-02-01 13:04:18 +00:00
w0rp b315667ebe
Fix #2192 - Handle more ignore-pattern messages for ESLint 2019-01-27 12:10:03 +00:00
w0rp 0495a8be20
Merge pull request #2153 from deltaskelta/gqlint-fix
changed gqlint to lint the file on disk
2018-12-18 10:20:44 +00:00
w0rp 6ef54842de
Merge pull request #2136 from hsanson/368-chktex-latex-report-errors-from-wrong-file
Fix 368 - Lacheck reports errors from input{} files.
2018-12-16 13:18:51 +00:00
w0rp df76d8a51c
Revert "Merge pull request #2083 from zackhsi/scalac-until-jvm"
This reverts commit 1c89495d77, reversing
changes made to 4b4b09593b.
2018-12-03 20:42:06 +00:00
14 changed files with 110 additions and 25 deletions

View File

@ -1,9 +1,15 @@
" Author: Michiel Westerbeek <happylinks@gmail.com>
" Description: Linter for GraphQL Schemas
function! ale_linters#graphql#gqlint#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer)
\ . 'gqlint'
\ . ' --reporter=simple %t'
endfunction
call ale#linter#Define('graphql', {
\ 'name': 'gqlint',
\ 'executable': 'gqlint',
\ 'command': 'gqlint --reporter=simple %t',
\ 'command_callback': 'ale_linters#graphql#gqlint#GetCommand',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@ -9,26 +9,20 @@ function! ale_linters#haskell#hie#GetProjectRoot(buffer) abort
" If it's empty, search for the cabal file
if empty(l:project_file)
let l:cabal_file = fnamemodify(bufname(a:buffer), ':p:h')
let l:paths = ''
while empty(matchstr(l:cabal_file, '^\(\/\|\(\w:\\\)\)$'))
let l:cabal_file = fnamemodify(l:cabal_file, ':h')
let l:paths = l:paths . l:cabal_file . ','
endwhile
" Search all of the paths except for the root filesystem path.
let l:paths = join(
\ ale#path#Upwards(expand('#' . a:buffer . ':p:h'))[:-2],
\ ','
\)
let l:project_file = globpath(l:paths, '*.cabal')
endif
" Either extract the project directory or take the current working
" directory
if !empty(l:project_file)
let l:project_file = fnamemodify(l:project_file, ':h')
else
let l:project_file = expand('#' . a:buffer . ':p:h')
" If we still can't find one, use the current file.
if empty(l:project_file)
let l:project_file = expand('#' . a:buffer . ':p')
endif
return l:project_file
return fnamemodify(l:project_file, ':h')
endfunction
function! ale_linters#haskell#hie#GetCommand(buffer) abort

View File

@ -155,7 +155,8 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
\}
if has_key(l:error, 'extra')
let l:errorToAdd.detail = s:GetDetails(l:error)
let l:errorToAdd.detail = l:errorToAdd.text
\ . "\n" . s:GetDetails(l:error)
endif
call add(l:output, l:errorToAdd)

View File

@ -9,7 +9,7 @@ endfunction
call ale#linter#Define('scala', {
\ 'name': 'scalac',
\ 'executable_callback': {buf -> s:IsSbt(buf) ? '' : 'scalac'},
\ 'command': '%e -Ystop-before:jvm %t',
\ 'command': '%e -Ystop-after:parser %t',
\ 'callback': 'ale#handlers#scala#HandleScalacLintFormat',
\ 'output_stream': 'stderr',
\})

View File

@ -8,20 +8,26 @@ function! ale_linters#tex#lacheck#Handle(buffer, lines) abort
"
" "book.tex", line 37: possible unwanted space at "{"
" "book.tex", line 38: missing `\ ' after "etc."
let l:pattern = '^".\+", line \(\d\+\): \(.\+\)$'
let l:pattern = '^"\(.\+\)", line \(\d\+\): \(.\+\)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
" lacheck follows `\input{}` commands. If the cwd is not the same as the
" file in the buffer then it will fail to find the inputed items. We do not
" want warnings from those items anyway
if !empty(matchstr(l:match[2], '^Could not open ".\+"$'))
if !empty(matchstr(l:match[3], '^Could not open ".\+"$'))
continue
endif
" lacheck follows `\input{}` commands. We are only interested in
" reporting errors for the current buffer only.
if empty(matchstr(fnamemodify(l:match[1], ':t'), fnamemodify(bufname(a:buffer), ':t')))
continue
endif
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'text': l:match[2],
\ 'lnum': l:match[2] + 0,
\ 'text': l:match[3],
\ 'type': 'W',
\})
endfor

View File

@ -121,7 +121,7 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort
let l:text = l:match[3]
if ale#Var(a:buffer, 'javascript_eslint_suppress_eslintignore')
if l:text is# 'File ignored because of a matching ignore pattern. Use "--no-ignore" to override.'
if l:text =~# '^File ignored'
continue
endif
endif

View File

@ -0,0 +1,11 @@
Before:
call ale#assert#SetUpLinterTest('graphql', 'gqlint')
After:
call ale#assert#TearDownLinterTest()
Execute(The linter should run from the directory of the file in the buffer):
AssertLinter 'gqlint',
\ ale#path#CdString(expand('%:p:h'))
\ . 'gqlint --reporter=simple'
\ . ' %t'

View File

@ -6,7 +6,7 @@ After:
Given scala(An empty Scala file):
Execute(The default executable and command should be correct):
AssertLinter 'scalac', ale#Escape('scalac') . ' -Ystop-before:jvm %t'
AssertLinter 'scalac', ale#Escape('scalac') . ' -Ystop-after:parser %t'
Given scala.sbt(An empty SBT file):
Execute(scalac should not be run for sbt files):

View File

@ -0,0 +1,13 @@
Before:
call ale#assert#SetUpLinterTest('tex', 'lacheck')
After:
call ale#assert#TearDownLinterTest()
Execute(Executable should default to lacheck):
AssertLinter 'lacheck', ale#Escape('lacheck') . ' %t'
Execute(Should be able to set a custom executable):
let g:ale_tex_lacheck_executable = 'bin/foo'
AssertLinter 'bin/foo' , ale#Escape('bin/foo') . ' %t'

View File

@ -342,6 +342,17 @@ Execute(eslint should warn about ignored files by default):
\ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]',
\ ])
AssertEqual
\ [{
\ 'lnum': 0,
\ 'col': 0,
\ 'type': 'W',
\ 'text': 'File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override.',
\ }],
\ ale#handlers#eslint#Handle(bufnr(''), [
\ '/path/to/some/ignored.js:0:0: File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override. [Warning]',
\ ])
Execute(eslint should not warn about ignored files when explicitly disabled):
let g:ale_javascript_eslint_suppress_eslintignore = 1
@ -351,6 +362,12 @@ Execute(eslint should not warn about ignored files when explicitly disabled):
\ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]',
\ ])
AssertEqual
\ [],
\ ale#handlers#eslint#Handle(bufnr(''), [
\ '/path/to/some/ignored.js:0:0: File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override. [Warning]',
\ ])
Execute(eslint should handle react errors correctly):
AssertEqual
\ [

View File

@ -499,7 +499,8 @@ Execute(The flow handler should handle extra errors):
\ 'col': 35,
\ 'type': 'E',
\ 'text': 'props of React element `New`: This type is incompatible with object type',
\ 'detail': 'Property `setVector` is incompatible: number This type is incompatible with function type ',
\ 'detail': 'props of React element `New`: This type is incompatible with object type'
\ . "\nProperty `setVector` is incompatible: number This type is incompatible with function type ",
\ }
\]

View File

@ -0,0 +1,36 @@
Before:
runtime ale_linters/tex/lacheck.vim
call ale#test#SetDirectory('/testplugin/test')
After:
call ale#linter#Reset()
call ale#test#RestoreDirectory()
Execute(The lacheck handler should parse lines correctly):
call ale#test#SetFilename('command_callback/tex_paths/sample1.tex')
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'type': 'W',
\ 'text': 'perhaps you should insert a `~'' before "\ref"'
\ }
\ ],
\ ale_linters#tex#lacheck#Handle(bufnr(''), [
\ "** sample1:",
\ "\"sample1.tex\", line 1: perhaps you should insert a `~' before \"\\ref\""
\ ])
Execute(The lacheck handler should ignore errors from input files):
call ale#test#SetFilename('ale_test.tex')
AssertEqual
\ [
\ ],
\ ale_linters#tex#lacheck#Handle(255, [
\ "** ale_input:",
\ "\"ale_input.tex\", line 1: perhaps you should insert a `~' before \"\\ref\""
\ ])