2017-08-30 21:11:04 +00:00
|
|
|
Before:
|
2019-10-06 16:29:23 +00:00
|
|
|
Save g:ale_c_parse_makefile
|
|
|
|
let g:ale_c_parse_makefile = 0
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#SetUpLinterTest('c', 'clangtidy')
|
2017-08-30 21:11:04 +00:00
|
|
|
call ale#test#SetFilename('test.c')
|
|
|
|
|
|
|
|
After:
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#TearDownLinterTest()
|
2017-08-30 21:11:04 +00:00
|
|
|
|
|
|
|
Execute(The clangtidy command default should be correct):
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
2018-10-29 22:48:05 +00:00
|
|
|
\ ale#Escape('clang-tidy') . ' %s'
|
2017-08-30 21:11:04 +00:00
|
|
|
|
|
|
|
Execute(You should be able to remove the -checks option for clang-tidy):
|
|
|
|
let b:ale_c_clangtidy_checks = []
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
|
|
|
\ ale#Escape('clang-tidy') . ' %s'
|
2017-08-30 21:11:04 +00:00
|
|
|
|
|
|
|
Execute(You should be able to set other checks for clang-tidy):
|
|
|
|
let b:ale_c_clangtidy_checks = ['-*', 'clang-analyzer-*']
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
2017-08-30 21:11:04 +00:00
|
|
|
\ ale#Escape('clang-tidy')
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s'
|
2017-08-30 21:11:04 +00:00
|
|
|
|
|
|
|
Execute(You should be able to manually set compiler flags for clang-tidy):
|
2018-10-29 22:48:05 +00:00
|
|
|
let b:ale_c_clangtidy_checks = ['*']
|
2017-08-30 21:11:04 +00:00
|
|
|
let b:ale_c_clangtidy_options = '-Wall'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
|
|
|
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
|
|
|
|
2019-06-08 19:12:43 +00:00
|
|
|
Execute(You should be able to manually set flags for clang-tidy):
|
|
|
|
let b:ale_c_clangtidy_extra_options = '-config='
|
|
|
|
|
|
|
|
AssertLinter 'clang-tidy',
|
|
|
|
\ ale#Escape('clang-tidy') . ' ' . ale#Escape('-config=') . ' %s'
|
|
|
|
|
2017-08-30 21:11:04 +00:00
|
|
|
Execute(The build directory should be configurable):
|
2018-10-29 22:48:05 +00:00
|
|
|
let b:ale_c_clangtidy_checks = ['*']
|
2017-08-30 21:11:04 +00:00
|
|
|
let b:ale_c_build_dir = '/foo/bar'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
2017-08-30 21:11:04 +00:00
|
|
|
\ ale#Escape('clang-tidy')
|
2017-10-18 22:42:51 +00:00
|
|
|
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . ' -p ' . ale#Escape('/foo/bar')
|
2017-08-30 21:11:04 +00:00
|
|
|
|
|
|
|
Execute(The build directory setting should override the options):
|
2018-10-29 22:48:05 +00:00
|
|
|
let b:ale_c_clangtidy_checks = ['*']
|
2017-08-30 21:11:04 +00:00
|
|
|
let b:ale_c_build_dir = '/foo/bar'
|
|
|
|
let b:ale_c_clangtidy_options = '-Wall'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
2017-08-30 21:11:04 +00:00
|
|
|
\ ale#Escape('clang-tidy')
|
2017-10-18 22:42:51 +00:00
|
|
|
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . ' -p ' . ale#Escape('/foo/bar')
|
2017-08-30 21:11:04 +00:00
|
|
|
|
|
|
|
Execute(The build directory should be ignored for header files):
|
|
|
|
call ale#test#SetFilename('test.h')
|
|
|
|
|
2018-10-29 22:48:05 +00:00
|
|
|
let b:ale_c_clangtidy_checks = ['*']
|
2017-08-30 21:11:04 +00:00
|
|
|
let b:ale_c_build_dir = '/foo/bar'
|
|
|
|
let b:ale_c_clangtidy_options = '-Wall'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
2017-08-30 21:11:04 +00:00
|
|
|
\ ale#Escape('clang-tidy')
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
|
|
|
|
2017-08-30 21:11:04 +00:00
|
|
|
call ale#test#SetFilename('test.h')
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
|
|
|
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
2017-08-30 21:11:04 +00:00
|
|
|
|
|
|
|
Execute(The executable should be configurable):
|
2018-10-29 22:48:05 +00:00
|
|
|
let b:ale_c_clangtidy_checks = ['*']
|
2017-08-30 21:11:04 +00:00
|
|
|
let b:ale_c_clangtidy_executable = 'foobar'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'foobar',
|
|
|
|
\ ale#Escape('foobar') . ' -checks=' . ale#Escape('*') . ' %s'
|