From e6292a8aaef1ec0ae74ef083351369203e687954 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 6 Oct 2024 15:59:55 -0400 Subject: Add lint option and cppcheck test --- tests/meson.build | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests') diff --git a/tests/meson.build b/tests/meson.build index 2c7f799f..39395bae 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -90,3 +90,31 @@ foreach test : integration_tests ], ) endforeach + +######## +# Lint # +######## + +if get_option('lint') + if not meson.is_subproject() + # Check code with cppcheck + cppcheck = find_program('cppcheck', required: false) + if cppcheck.found() + compdb_path = join_paths(ingen_build_root, 'compile_commands.json') + suppress_path = join_paths(ingen_src_root, '.suppress.cppcheck') + test( + 'cppcheck', + cppcheck, + args: [ + '--enable=warning,style,performance,portability', + '--error-exitcode=1', + '--project=' + compdb_path, + '--suppressions-list=' + suppress_path, + '-q', + ], + suite: 'code', + timeout: 60, + ) + endif + endif +endif -- cgit v1.2.1