diff options
author | David Robillard <d@drobilla.net> | 2024-09-27 19:12:06 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-09-28 11:08:21 -0400 |
commit | f0b4f46f6168968c92ca615f4cbb2f966005c779 (patch) | |
tree | f4be542d2eab37b3ac603d94d986eb2bf115cf79 | |
parent | 51a4acc55b233658501eacdcaf88c1f9917e0576 (diff) | |
download | serd-f0b4f46f6168968c92ca615f4cbb2f966005c779.tar.gz serd-f0b4f46f6168968c92ca615f4cbb2f966005c779.tar.bz2 serd-f0b4f46f6168968c92ca615f4cbb2f966005c779.zip |
Add cppcheck lint test
-rw-r--r-- | .reuse/dep5 | 5 | ||||
-rw-r--r-- | .suppress.cppcheck | 4 | ||||
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | test/meson.build | 21 |
4 files changed, 31 insertions, 0 deletions
diff --git a/.reuse/dep5 b/.reuse/dep5 index 3173226a..78dc2af5 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -3,6 +3,11 @@ Upstream-Name: serd Upstream-Contact: David Robillard <d@drobilla.net> Source: https://gitlab.com/drobilla/serd +Files: .suppress.cppcheck +Copyright: 2024 David Robillard <d@drobilla.net> +Comment: Contributed to the Commons as a tool configuration +License: 0BSD OR ISC + Files: test/w3c/* Copyright: 2010 World Wide Web Consortium, (MIT, ERCIM, Keio, Beihang) and others. Comment: Standard test suites from the W3C diff --git a/.suppress.cppcheck b/.suppress.cppcheck new file mode 100644 index 00000000..292f6884 --- /dev/null +++ b/.suppress.cppcheck @@ -0,0 +1,4 @@ +assignmentInAssert +normalCheckLevelMaxBranches +redundantInitialization +unreadVariable diff --git a/meson.build b/meson.build index 4b01ff9c..2a05f8a6 100644 --- a/meson.build +++ b/meson.build @@ -16,6 +16,7 @@ project( ) serd_src_root = meson.current_source_dir() +serd_build_root = meson.current_build_dir() major_version = meson.project_version().split('.')[0] version_suffix = '-@0@'.format(major_version) versioned_name = 'serd' + version_suffix diff --git a/test/meson.build b/test/meson.build index 33f86dfb..530c0d13 100644 --- a/test/meson.build +++ b/test/meson.build @@ -61,6 +61,27 @@ if get_option('lint') ) endif + # Check code with cppcheck + if not meson.is_subproject() + cppcheck = find_program('cppcheck', required: false) + if cppcheck.found() + compdb_path = join_paths(serd_build_root, 'compile_commands.json') + suppress_path = join_paths(serd_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', + ) + endif + endif + # Check script formatting black = find_program('black', required: false) if black.found() |