summaryrefslogtreecommitdiffstats
path: root/test/lint
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2025-01-10 11:38:38 -0500
committerDavid Robillard <d@drobilla.net>2025-01-10 11:38:38 -0500
commit3f4c8cd0523f6dd23825a109530067a7a1d443c8 (patch)
tree2eed714d4ec881bf25e5cdb0d510ccd17374eb58 /test/lint
parentfccae6d1db416835dab147554d832a1726e68a5a (diff)
downloadsratom-3f4c8cd0523f6dd23825a109530067a7a1d443c8.tar.gz
sratom-3f4c8cd0523f6dd23825a109530067a7a1d443c8.tar.bz2
sratom-3f4c8cd0523f6dd23825a109530067a7a1d443c8.zip
Use cppcheck working directory
This allows for better analysis, and adds a cache to improve checking times, especially on repeated runs.
Diffstat (limited to 'test/lint')
-rw-r--r--test/lint/meson.build40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/lint/meson.build b/test/lint/meson.build
new file mode 100644
index 0000000..9aaa339
--- /dev/null
+++ b/test/lint/meson.build
@@ -0,0 +1,40 @@
+# Copyright 2021-2024 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: 0BSD OR ISC
+
+all_sources = sources + test_sratom_source + test_headers_source
+
+# Check licensing metadata
+reuse = find_program('reuse', required: false)
+if reuse.found()
+ reuse_args = ['--root', sratom_src_root, 'lint']
+ test('REUSE', reuse, args: reuse_args, suite: 'data')
+endif
+
+# Check code formatting
+clang_format = find_program('clang-format', required: false)
+if clang_format.found()
+ clang_format_args = ['--Werror', '--dry-run'] + c_headers + all_sources
+ test('format', clang_format, args: clang_format_args, suite: 'code')
+endif
+
+if not meson.is_subproject()
+ # Check release metadata
+ autoship = find_program('autoship', required: false)
+ if autoship.found()
+ test('autoship', autoship, args: ['test', sratom_src_root], suite: 'data')
+ endif
+
+ # Check code with cppcheck
+ cppcheck = find_program('cppcheck', required: false)
+ if cppcheck.found()
+ compdb_path = join_paths(sratom_build_root, 'compile_commands.json')
+ cppcheck_args = [
+ '--enable=warning,style,performance,portability',
+ '--error-exitcode=1',
+ '--project=' + compdb_path,
+ '--suppress=normalCheckLevelMaxBranches',
+ '-q',
+ ]
+ test('cppcheck', cppcheck, args: cppcheck_args, suite: 'code')
+ endif
+endif