summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-10-11 18:26:56 -0400
committerDavid Robillard <d@drobilla.net>2024-10-11 18:27:04 -0400
commit2e680d433275a1a68db7b44f6c7a27961d1ac49c (patch)
treec79fa5921e23e45d851184c8d52779e268a4a24e
parentc627dc84ede8b7c2c607ed1a871707969269748b (diff)
downloadpatchage-2e680d433275a1a68db7b44f6c7a27961d1ac49c.tar.gz
patchage-2e680d433275a1a68db7b44f6c7a27961d1ac49c.tar.bz2
patchage-2e680d433275a1a68db7b44f6c7a27961d1ac49c.zip
Add cpplint test
-rw-r--r--.reuse/dep55
-rw-r--r--.suppress.cppcheck9
-rw-r--r--meson.build21
3 files changed, 35 insertions, 0 deletions
diff --git a/.reuse/dep5 b/.reuse/dep5
index 0685ea3..44e287b 100644
--- a/.reuse/dep5
+++ b/.reuse/dep5
@@ -7,6 +7,11 @@ Files: .clant.json .includes.imp INSTALL.md NEWS
Copyright: 2020-2021 David Robillard <d@drobilla.net>
License: 0BSD OR GPL-3.0-or-later
+Files: .suppress.cppcheck
+Copyright: 2024 David Robillard <d@drobilla.net>
+Comment: Contributed to the Commons as a tool configuration
+License: 0BSD OR GPL-3.0-or-later
+
Files: AUTHORS README.md patchage.desktop.in
Copyright: 2006-2014 David Robillard <d@drobilla.net>
License: 0BSD OR GPL-3.0-or-later
diff --git a/.suppress.cppcheck b/.suppress.cppcheck
new file mode 100644
index 0000000..d9c8659
--- /dev/null
+++ b/.suppress.cppcheck
@@ -0,0 +1,9 @@
+constParameterCallback
+constVariablePointer
+constVariableReference
+duplicateBreak
+missingReturn
+normalCheckLevelMaxBranches
+returnByReference
+shadowFunction
+virtualCallInConstructor
diff --git a/meson.build b/meson.build
index 32c79d4..15fb371 100644
--- a/meson.build
+++ b/meson.build
@@ -15,6 +15,7 @@ project(
)
patchage_src_root = meson.current_source_dir()
+patchage_build_root = meson.current_build_dir()
major_version = meson.project_version().split('.')[0]
version_suffix = '@0@-@1@'.format(meson.project_name(), major_version)
@@ -267,6 +268,26 @@ if get_option('lint')
suite: 'data',
)
endif
+
+ # Check code with cppcheck
+ cppcheck = find_program('cppcheck', required: false)
+ if cppcheck.found()
+ compdb_path = join_paths(patchage_build_root, 'compile_commands.json')
+ suppress_path = join_paths(patchage_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
# Check licensing metadata