2017-05-02 21:44:08 +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('cpp', 'clangtidy')
|
2017-07-20 13:52:24 +00:00
|
|
|
call ale#test#SetFilename('test.cpp')
|
|
|
|
|
2017-05-02 21:44:08 +00:00
|
|
|
After:
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#TearDownLinterTest()
|
2017-05-02 21:44:08 +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-05-02 21:44:08 +00:00
|
|
|
|
|
|
|
Execute(You should be able to remove the -checks option for clang-tidy):
|
2017-07-16 23:07:18 +00:00
|
|
|
let b:ale_cpp_clangtidy_checks = []
|
|
|
|
|
2018-10-29 22:48:05 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
|
|
|
\ ale#Escape('clang-tidy') . ' %s'
|
2017-05-02 21:44:08 +00:00
|
|
|
|
|
|
|
Execute(You should be able to set other checks for clang-tidy):
|
2017-07-16 23:07:18 +00:00
|
|
|
let b:ale_cpp_clangtidy_checks = ['-*', 'clang-analyzer-*']
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
2017-07-16 23:07:18 +00:00
|
|
|
\ ale#Escape('clang-tidy')
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s'
|
2017-05-02 21:44:08 +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_cpp_clangtidy_checks = ['*']
|
2017-07-16 23:07:18 +00:00
|
|
|
let b:ale_cpp_clangtidy_options = '-Wall'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
|
|
|
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
2018-10-29 22:48:05 +00:00
|
|
|
|
2019-06-08 19:12:43 +00:00
|
|
|
Execute(You should be able to manually set flags for clang-tidy):
|
|
|
|
let b:ale_cpp_clangtidy_extra_options = '-config='
|
|
|
|
|
|
|
|
AssertLinter 'clang-tidy',
|
|
|
|
\ ale#Escape('clang-tidy') . ' ' . ale#Escape('-config=') . ' %s'
|
|
|
|
|
2017-07-16 23:07:18 +00:00
|
|
|
Execute(The build directory should be configurable):
|
2018-10-29 22:48:05 +00:00
|
|
|
let b:ale_cpp_clangtidy_checks = ['*']
|
2017-07-16 23:07:18 +00:00
|
|
|
let b:ale_c_build_dir = '/foo/bar'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
2017-07-16 23:07:18 +00:00
|
|
|
\ ale#Escape('clang-tidy')
|
2018-10-29 22:48:05 +00:00
|
|
|
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
|
|
|
\ . ' -p ' . ale#Escape('/foo/bar')
|
2017-07-16 23:07:18 +00:00
|
|
|
|
|
|
|
Execute(The build directory setting should override the options):
|
2018-10-29 22:48:05 +00:00
|
|
|
let b:ale_cpp_clangtidy_checks = ['*']
|
2017-07-16 23:07:18 +00:00
|
|
|
let b:ale_c_build_dir = '/foo/bar'
|
|
|
|
let b:ale_cpp_clangtidy_options = '-Wall'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
2017-07-16 23:07:18 +00:00
|
|
|
\ ale#Escape('clang-tidy')
|
2018-10-29 22:48:05 +00:00
|
|
|
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
|
|
|
\ . ' -p ' . ale#Escape('/foo/bar')
|
2017-07-16 23:07:18 +00:00
|
|
|
|
2020-08-10 01:14:23 +00:00
|
|
|
Execute(The build directory should be used for header files):
|
2017-07-20 13:52:24 +00:00
|
|
|
call ale#test#SetFilename('test.h')
|
|
|
|
|
2018-10-29 22:48:05 +00:00
|
|
|
let b:ale_cpp_clangtidy_checks = ['*']
|
2017-07-20 13:52:24 +00:00
|
|
|
let b:ale_c_build_dir = '/foo/bar'
|
|
|
|
let b:ale_cpp_clangtidy_options = '-Wall'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
2018-10-29 22:48:05 +00:00
|
|
|
\ ale#Escape('clang-tidy')
|
2020-08-10 01:14:23 +00:00
|
|
|
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
|
|
|
\ . ' -p ' . ale#Escape('/foo/bar')
|
2018-07-15 17:24:53 +00:00
|
|
|
|
2017-07-20 13:52:24 +00:00
|
|
|
call ale#test#SetFilename('test.hpp')
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'clang-tidy',
|
2020-08-10 01:14:23 +00:00
|
|
|
\ ale#Escape('clang-tidy')
|
|
|
|
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
|
|
|
\ . ' -p ' . ale#Escape('/foo/bar')
|
2017-07-20 13:52:24 +00:00
|
|
|
|
2017-07-16 23:07:18 +00:00
|
|
|
Execute(The executable should be configurable):
|
2018-10-29 22:48:05 +00:00
|
|
|
let b:ale_cpp_clangtidy_checks = ['*']
|
2017-07-16 23:07:18 +00:00
|
|
|
let b:ale_cpp_clangtidy_executable = 'foobar'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'foobar',
|
|
|
|
\ ale#Escape('foobar') . ' -checks=' . ale#Escape('*') . ' %s'
|