diff options
author | David Robillard <d@drobilla.net> | 2019-11-09 12:14:42 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-11-09 12:15:17 +0100 |
commit | 66c9a39d29bab7467a29267b8554274b9df9a5ee (patch) | |
tree | 21541a0c6199621f528a5f39164dcbcd644ed9c2 | |
parent | 2b029213f97910692d1e48e097cc5cc1ad3b44b7 (diff) | |
download | pugl-66c9a39d29bab7467a29267b8554274b9df9a5ee.tar.gz pugl-66c9a39d29bab7467a29267b8554274b9df9a5ee.tar.bz2 pugl-66c9a39d29bab7467a29267b8554274b9df9a5ee.zip |
Add clang-tidy file and update lint target
-rw-r--r-- | .clang-tidy | 13 | ||||
-rw-r--r-- | wscript | 34 |
2 files changed, 27 insertions, 20 deletions
diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..750180d --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,13 @@ +Checks: > + *, + -*magic-numbers, + -*uppercase-literal-suffix, + -bugprone-suspicious-string-compare, + -clang-analyzer-alpha.*, + -hicpp-multiway-paths-covered, + -hicpp-signed-bitwise, + -llvm-header-guard, + -readability-else-after-return +WarningsAsErrors: '' +HeaderFilterRegex: '.*' +FormatStyle: file @@ -55,7 +55,8 @@ def configure(conf): for f in ('CFLAGS', 'CXXFLAGS'): conf.env.append_value(f, ['-fvisibility=hidden']) if Options.options.strict: - conf.env.append_value(f, ['-Wunused-parameter', '-Wno-pedantic']) + conf.env.append_value(f, ['-Wunused-parameter', + '-Wno-pedantic']) autowaf.set_c_lang(conf, 'c99') @@ -64,8 +65,11 @@ def configure(conf): conf.define('HAVE_GL', 1) conf.define('PUGL_HAVE_GL', 1) - conf.check(features='c cshlib', lib='m', uselib_store='M', mandatory=False) - conf.check(features='c cshlib', lib='dl', uselib_store='DL', mandatory=False) + conf.check(features='c cshlib', lib='m', + uselib_store='M', mandatory=False) + + conf.check(features='c cshlib', lib='dl', + uselib_store='DL', mandatory=False) if not Options.options.no_cairo: autowaf.check_pkg(conf, 'cairo', @@ -294,28 +298,18 @@ def test(tst): def lint(ctx): "checks code for style issues" + import json import subprocess subprocess.call("flake8 wscript --ignore E221,W504,E251,E241", shell=True) - cmd = ("clang-tidy -p=. -header-filter=.* -checks=\"*," + - "-bugprone-suspicious-string-compare," + - "-clang-analyzer-alpha.*," + - "-cppcoreguidelines-avoid-magic-numbers," + - "-google-readability-todo," + - "-hicpp-multiway-paths-covered," + - "-hicpp-signed-bitwise," + - "-hicpp-uppercase-literal-suffix," + - "-llvm-header-guard," + - "-misc-misplaced-const," + - "-misc-unused-parameters," + - "-readability-else-after-return," + - "-readability-magic-numbers," + - "-readability-uppercase-literal-suffix\" " + - "../pugl/detail/*.c") - - subprocess.call(cmd, cwd='build', shell=True) + with open('build/compile_commands.json', 'r') as db: + commands = json.load(db) + files = [c['file'] for c in commands + if os.path.basename(c['file']) != 'glad.c'] + + subprocess.call(['clang-tidy'] + files, cwd='build') try: subprocess.call(['iwyu_tool.py', '-o', 'clang', '-p', 'build']) |