Added additional unit tests + adapted review comments #1167

This commit is contained in:
roel0
2018-03-21 20:44:35 +01:00
parent 7593e20377
commit 69237a7e57
5 changed files with 92 additions and 66 deletions

View File

@@ -9,15 +9,7 @@ function! ale_linters#c#clang#GetExecutable(buffer) abort
endfunction
function! ale_linters#c#clang#GetCommand(buffer, output) abort
let l:cflags = []
if !empty(a:output)
let l:cflags = join(ale#c#ParseMakefile(a:buffer, join(a:output, '\n')), ' ')
endif
if empty(l:cflags)
let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))
else
let l:cflags .= ' '
endif
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
" -iquote with the directory the file is in makes #include work for
" headers in the same directory.
@@ -33,7 +25,7 @@ call ale#linter#Define('c', {
\ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#c#clang#GetExecutable',
\ 'command_chain': [
\ {'callback': 'ale#c#ParseMakefile', 'output_stream': 'stdout'},
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
\ {'callback': 'ale_linters#c#clang#GetCommand'}
\ ],
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',

View File

@@ -9,15 +9,7 @@ function! ale_linters#c#gcc#GetExecutable(buffer) abort
endfunction
function! ale_linters#c#gcc#GetCommand(buffer, output) abort
let l:cflags = []
if !empty(a:output)
let l:cflags = join(ale#c#ParseCFlags(a:buffer, join(a:output, '\n')), ' ')
endif
if empty(l:cflags)
let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))
else
let l:cflags .= ' '
endif
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
" -iquote with the directory the file is in makes #include work for
" headers in the same directory.
@@ -33,7 +25,7 @@ call ale#linter#Define('c', {
\ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#c#gcc#GetExecutable',
\ 'command_chain': [
\ {'callback': 'ale#c#ParseMakefile', 'output_stream': 'stdout'},
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
\ {'callback': 'ale_linters#c#gcc#GetCommand'}
\ ],
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',