gitlabci: fix lint:tidy

parent aaec7c9e
---
Checks: 'bugprone-*,cert-*,-clang-analyzer-unix.Malloc,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-valist.Uninitialized,readability-*,-readability-braces-*,-readability-else-after-return,-readability-redundant-declaration,-readability-non-const-parameter,google-readability-casting,misc-*,-misc-macro-parentheses,-misc-unused-parameters'
Checks: 'bugprone-*,cert-*,-cert-dcl03-c,-clang-analyzer-unix.Malloc,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-valist.Uninitialized,readability-*,-readability-braces-*,-readability-else-after-return,-readability-redundant-declaration,-readability-non-const-parameter,google-readability-casting,misc-*,-misc-static-assert,-misc-macro-parentheses,-misc-unused-parameters'
WarningsAsErrors: 'cert-*,misc-*,readability-*,clang-analyzer-*,-readability-non-const-parameter'
HeaderFilterRegex: 'contrib/ucw/*.h'
CheckOptions:
......@@ -8,4 +8,4 @@ CheckOptions:
- key: readability-function-size.StatementThreshold
value: '400'
- key: readability-function-size.LineThreshold
value: '500'
\ No newline at end of file
value: '500'
......@@ -131,6 +131,14 @@ kres-gen:
tags:
- docker
lint:tidy:
<<: *test
before_script: []
tags:
- docker
script:
- ninja -C build_ci* tidy
lint:pedantic:
<<: *test_nodep
tags:
......@@ -155,16 +163,6 @@ lint:lua:
tags:
- docker
lint:c:
stage: test
except:
- master
dependencies: [] # do not download build artifacts
script:
- make lint-c CLANG_TIDY="clang-tidy -quiet"
tags:
- docker
lint:clang-scan-build:
stage: test
except:
......
# bench
bench_lru_src = [
bench_lru_src = files([
'bench_lru.c',
]
])
cc = meson.get_compiler('c')
m_dep = cc.find_library('m', required : false)
......
# client
kresc_src = [
kresc_src = files([
'kresc.c',
]
])
c_src_lint += kresc_src
build_client = false
if not get_option('client').disabled()
......
# contrib
contrib_src = [
contrib_src = files([
'ccan/asprintf/asprintf.c',
'ccan/ilog/ilog.c',
'ccan/json/json.c',
......@@ -9,7 +9,7 @@ contrib_src = [
'murmurhash3/murmurhash3.c',
'base32hex.c',
'base64.c'
]
])
contrib_inc = include_directories('.')
......
# daemon
kresd_src = [
kresd_src = files([
'bindings/cache.c',
'bindings/event.c',
'bindings/impl.c',
......@@ -18,7 +18,8 @@ kresd_src = [
'tls_session_ticket-srv.c',
'worker.c',
'zimport.c',
]
])
c_src_lint += kresd_src
config_tests += [
['cache.clear', files('cache.test/clear.test.lua')],
......
......@@ -90,8 +90,8 @@ int kr_authenticate_referral(const knot_rrset_t *ref, const dnssec_key_t *key)
static int adjust_wire_ttl(uint8_t *wire, size_t wire_size, uint32_t new_ttl)
{
assert(wire);
assert(sizeof(uint16_t) == 2);
assert(sizeof(uint32_t) == 4);
static_assert(sizeof(uint16_t) == 2, "uint16_t must be exactly 2 bytes");
static_assert(sizeof(uint32_t) == 4, "uint32_t) must be exactly 4 bytes");
uint16_t rdlen;
int ret;
......
# libkres
libkres_src = [
libkres_src = files([
'cache/api.c',
'cache/cdb_lmdb.c',
'cache/entry_list.c',
......@@ -28,9 +28,10 @@ libkres_src = [
'rplan.c',
'utils.c',
'zonecut.c',
]
])
c_src_lint += libkres_src
libkres_headers = [
libkres_headers = files([
'cache/api.h',
'cache/cdb_api.h',
'cache/cdb_lmdb.h',
......@@ -55,7 +56,7 @@ libkres_headers = [
'rplan.h',
'utils.h',
'zonecut.h',
]
])
unit_tests += [
['array', files('generic/test_array.c')],
......
......@@ -96,6 +96,9 @@ add_project_arguments(
language: 'c',
)
# Files for clang-tidy lint
c_src_lint = files()
# Lists of tests
# These lists are added to from subdir() and finally used in tests/*
......@@ -151,6 +154,21 @@ if get_option('bench').enabled()
endif
# Lint
message('--- lint dependencies ---')
clangtidy = find_program('clang-tidy', required: false)
message('-------------------------')
if clangtidy.found()
run_target(
'tidy',
command: [
clangtidy,
'-quiet',
'-p', meson.build_root(),
] + c_src_lint
)
endif
# Tests
subdir('tests')
......
# C module: bogus_log
bogus_log_src = [
bogus_log_src = files([
'bogus_log.c',
]
])
c_src_lint += bogus_log_src
bogus_log_mod = shared_module(
'bogus_log',
......
# C module: dnstap
dnstap_src = [
dnstap_src = files([
'dnstap.c',
]
])
## dnstap dependencies
message('--- dnstap module dependencies ---')
......@@ -14,6 +14,8 @@ message('----------------------------------')
# build dnstap if deps are found
if libprotobuf_c.found() and libfstrm.found() and protoc_c.found()
c_src_lint += dnstap_src
# generate protobuf-c sources using protoc-c
dnstap_pb = custom_target(
'dnstap_pb',
......
# C module: edns_keepalive
edns_keepalive_src = [
edns_keepalive_src = files([
'edns_keepalive.c',
]
])
c_src_lint += edns_keepalive_src
edns_keepalive_mod = shared_module(
'edns_keepalive',
......
# C module: hints
hints_src = [
hints_src = files([
'hints.c',
]
])
c_src_lint += hints_src
hints_mod = shared_module(
'hints',
......
# C module: nsid
nsid_src = [
nsid_src = files([
'nsid.c',
]
])
c_src_lint += nsid_src
nsid_mod = shared_module(
'nsid',
......
......@@ -22,11 +22,11 @@ if lua_ac_submodule.returncode() != 0
endif
# compile bundled lua-aho-corasick lib
lua_ac_src = [
lua_ac_src = files([
'lua-aho-corasick/ac_fast.cxx',
'lua-aho-corasick/ac_lua.cxx',
'lua-aho-corasick/ac_slow.cxx',
]
])
lua_ac_lib = shared_module(
'ahocorasick',
......
# C module: stats
stats_src = [
stats_src = files([
'stats.c',
]
])
c_src_lint += stats_src
integr_tests += [
['stats', join_paths(meson.current_source_dir(), 'test.integr')],
......
......@@ -10,10 +10,10 @@ py3_deps += [
]
# compile tlsproxy
tlsproxy_src = [
tlsproxy_src = files([
'proxy/tlsproxy.c',
'proxy/tls-proxy.c',
]
])
tlsproxy = executable(
'tlsproxy',
tlsproxy_src,
......
# tests: unit
# mock module for test_module
mock_cmodule_src = [
mock_cmodule_src = files([
'mock_cmodule.c',
]
])
mock_cmodule_lib = shared_library(
'mock_cmodule',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment