diff options
author | David Robillard <d@drobilla.net> | 2025-01-10 11:27:22 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2025-01-10 11:30:10 -0500 |
commit | ccd3a56cf3777b105a163d9ac41998df92ecf650 (patch) | |
tree | fc745f9deb242998300a87a41e983e8157786a7c | |
parent | 8ab9795a4c0403a88cd01874caf5f58776ae24ca (diff) | |
download | zix-ccd3a56cf3777b105a163d9ac41998df92ecf650.tar.gz zix-ccd3a56cf3777b105a163d9ac41998df92ecf650.tar.bz2 zix-ccd3a56cf3777b105a163d9ac41998df92ecf650.zip |
Use cppcheck working directory
This allows for better analysis, and adds a cache to improve checking times,
especially on repeated runs.
-rw-r--r-- | test/lint/meson.build | 42 | ||||
-rw-r--r-- | test/meson.build | 39 |
2 files changed, 43 insertions, 38 deletions
diff --git a/test/lint/meson.build b/test/lint/meson.build new file mode 100644 index 0000000..13966cf --- /dev/null +++ b/test/lint/meson.build @@ -0,0 +1,42 @@ +# Copyright 2024 David Robillard <d@drobilla.net> +# SPDX-License-Identifier: 0BSD OR ISC + +if not meson.is_subproject() + # Check release metadata + autoship = find_program('autoship', required: get_option('tests')) + if autoship.found() + test('autoship', autoship, args: ['test', zix_src_root], suite: 'data') + endif + + # Check code with cppcheck + cppcheck = find_program('cppcheck', required: false) + if cppcheck.found() + compdb_path = join_paths(zix_build_root, 'compile_commands.json') + cppcheck_args = [ + '--cppcheck-build-dir=' + meson.current_build_dir(), + '--enable=warning,style,performance,portability', + '--error-exitcode=1', + '--project=' + compdb_path, + '--suppress=constParameterCallback', + '--suppress=constParameterPointer', + '--suppress=normalCheckLevelMaxBranches', + '--suppress=unreadVariable', + '-q', + ] + test('cppcheck', cppcheck, args: cppcheck_args, suite: 'code') + endif +endif + +# Check licensing metadata +reuse = find_program('reuse', required: get_option('tests')) +if reuse.found() + reuse_args = ['--root', zix_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 + sources + test('format', clang_format, args: clang_format_args, suite: 'code') +endif diff --git a/test/meson.build b/test/meson.build index 63141bb..32cc736 100644 --- a/test/meson.build +++ b/test/meson.build @@ -6,44 +6,7 @@ ######## if get_option('lint') - if not meson.is_subproject() - # Check release metadata - autoship = find_program('autoship', required: get_option('tests')) - if autoship.found() - test('autoship', autoship, args: ['test', zix_src_root], suite: 'data') - endif - - # Check code with cppcheck - cppcheck = find_program('cppcheck', required: false) - if cppcheck.found() - compdb_path = join_paths(zix_build_root, 'compile_commands.json') - cppcheck_args = [ - '--enable=warning,style,performance,portability', - '--error-exitcode=1', - '--project=' + compdb_path, - '--suppress=constParameterCallback', - '--suppress=constParameterPointer', - '--suppress=normalCheckLevelMaxBranches', - '--suppress=unreadVariable', - '-q', - ] - test('cppcheck', cppcheck, args: cppcheck_args, suite: 'code') - endif - endif - - # Check licensing metadata - reuse = find_program('reuse', required: get_option('tests')) - if reuse.found() - reuse_args = ['--root', zix_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 + sources - test('format', clang_format, args: clang_format_args, suite: 'code') - endif + subdir('lint') endif ############## |