diff options
-rw-r--r-- | .suppress.cppcheck | 26 | ||||
-rw-r--r-- | meson_options.txt | 3 | ||||
-rw-r--r-- | tests/meson.build | 28 |
3 files changed, 57 insertions, 0 deletions
diff --git a/.suppress.cppcheck b/.suppress.cppcheck new file mode 100644 index 00000000..a92b4f94 --- /dev/null +++ b/.suppress.cppcheck @@ -0,0 +1,26 @@ +arithOperationsOnVoidPointer +constParameterPointer +constParameterReference +constVariablePointer +constVariableReference +cstyleCast +duplInheritedMember +duplicateExpression +knownConditionTrueFalse +memleakOnRealloc +missingReturn +noExplicitConstructor +normalCheckLevelMaxBranches +nullPointerArithmetic +passedByValue +rethrowNoCurrentException +shadowFunction +unreadVariable +unsafeClassCanLeak +unusedPrivateFunction +useStlAlgorithm +uselessCallsSubstr +uselessOverride +va_list_usedBeforeStarted +variableScope +virtualCallInConstructor diff --git a/meson_options.txt b/meson_options.txt index 686898a9..fcf48ff9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,6 +16,9 @@ option('gui', type: 'feature', value: 'auto', yield: true, option('jack', type: 'feature', value: 'auto', yield: true, description: 'Build JACK audio and MIDI support') +option('lint', type: 'boolean', value: false, yield: true, + description: 'Run code quality checks') + option('lv2dir', type: 'string', value: '', yield: true, description: 'LV2 bundle installation directory') diff --git a/tests/meson.build b/tests/meson.build index 2c7f799f..39395bae 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -90,3 +90,31 @@ foreach test : integration_tests ], ) endforeach + +######## +# Lint # +######## + +if get_option('lint') + if not meson.is_subproject() + # Check code with cppcheck + cppcheck = find_program('cppcheck', required: false) + if cppcheck.found() + compdb_path = join_paths(ingen_build_root, 'compile_commands.json') + suppress_path = join_paths(ingen_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 +endif |