diff options
-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() |