--- /dev/null
+---
+Checks: 'bugprone-*,cert-*,-clang-analyzer-unix.Malloc,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-valist.Uninitialized,-readability-*,-readability-braces-*,-readability-else-after-return,google-readability-casting,misc-*,-misc-macro-parentheses,-misc-unused-parameters'
+WarningsAsErrors: 'cert-*,misc-*,readability-*,clang-analyzer-*,-readability-non-const-parameter'
+HeaderFilterRegex: 'contrib/ucw/*.h'
+CheckOptions:
+ - key: readability-identifier-naming
+ value: 'lower_case'
+ - key: readability-function-size.StatementThreshold
+ value: '400'
+ - key: readability-function-size.LineThreshold
+ value: '500'
\ No newline at end of file
build:clang:linux:amd64:
stage: build
+ image: $CI_REGISTRY/knot/knot-resolver/ci:debian-unstable # newer Debian for newer Clang
script:
- - CXX=clang++ CC=clang PREFIX=$(pwd)/.local make -k all CFLAGS=-Werror
- - CXX=clang++ CC=clang PREFIX=$(pwd)/.local make install CFLAGS=-Werror
+ - CXX=clang++-5.0 CC=clang-5.0 PREFIX=$(pwd)/.local make -k all CFLAGS=-Werror
+ - CXX=clang++-5.0 CC=clang-5.0 PREFIX=$(pwd)/.local make install CFLAGS=-Werror
tags:
- docker
- linux
stage: test
dependencies: [] # do not download build artifacts
script:
- - make lint
+ - make lint-lua
+ tags:
+ - docker
+
+lint:c:
+ stage: test
+ image: $CI_REGISTRY/knot/knot-resolver/ci:debian-unstable # newer Debian for newer Clang
+ dependencies: [] # do not download build artifacts
+ script:
+ - make lint-c CLANG_TIDY="clang-tidy-5.0 -quiet"
tags:
- docker
clean: contrib-clean lib-clean daemon-clean client-clean modules-clean \
tests-clean doc-clean bench-clean coverage-clean
doc: doc-html
-lint: $(patsubst %.lua.in,%.lua,$(wildcard */*/*.lua.in))
+lint: lint-lua lint-c
+lint-c: libkres-lint kresd-lint kresc-lint
+lint-lua: $(patsubst %.lua.in,%.lua,$(wildcard */*/*.lua.in))
luacheck --codes --formatter TAP .
.PHONY: all install check clean doc info lint
RUN luarocks install luacov
# LuaJIT binary for stand-alone scripting
-RUN apt-get install -y -qqq luajit
-
-# clang for kresd CI
-RUN apt-get install -y -qqq clang
+RUN apt-get install -y -qqq luajit
\ No newline at end of file
"libprotobuf_ 3.0+", "``modules/dnstap``", "Protocol Buffers support for dnstap_."
"`libprotobuf-c`_ 1.0+", "``modules/dnstap``", "C bindings for Protobuf."
"libfstrm_ 0.2+", "``modules/dnstap``", "Frame Streams data transport protocol."
- "luacheck_", "``lint``", "Syntax and static analysis checker for Lua."
+ "luacheck_", "``lint-lua``", "Syntax and static analysis checker for Lua."
+ "`clang-tidy`_", "``lint-c``", "Syntax and static analysis checker for C."
"luacov_", "``check-config``", "Code coverage analysis for Lua modules."
.. [#] Requires C99, ``__attribute__((cleanup))`` and ``-MMD -MP`` for dependency file generation. GCC, Clang and ICC are supported.
Running unit and integration tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The linter requires luacheck_ and is executed by ``make lint``.
+The linter requires luacheck_ and `clang-tidy`_ and is executed by ``make lint``.
The unit tests require cmocka_ and are executed by ``make check``.
Tests for the dnstap module need go and are executed by ``make ckeck-dnstap``.
.. _libprotobuf-c: https://github.com/protobuf-c/protobuf-c/wiki
.. _libfstrm: https://github.com/farsightsec/fstrm
.. _luacheck: http://luacheck.readthedocs.io
+.. _clang-tidy: http://clang.llvm.org/extra/clang-tidy/index.html
.. _luacov: https://keplerproject.github.io/luacov/
.. _lcov: http://ltp.sourceforge.net/coverage/lcov.php
# Platform-dependent stuff checks
CCLD := $(CC)
+CLANG_TIDY ?= clang-tidy -quiet
CGO := go tool cgo
GO := go
CAT := cat
$(call quiet,CCLD,$$@) $$($(1)_CFLAGS) $(BUILD_CFLAGS) $$($(1)_OBJ) $(call SOVER,$(7),$(7),$(1)) -o $$@ $(4) $$($(1)_LIBS) $(BUILD_LDFLAGS) $$($(1)_LDFLAGS)
endif
endif
+# Linter rules
+$(1)-lint: $$($(1)_SOURCES)
+ $(call quiet,CLANG_TIDY,$(1)) $$($(1)_SOURCES) -- $(BUILD_CFLAGS) $$($(1)_CFLAGS) -DMP_FREELIST_SIZE=0 -D__clang_analyzer__
# Additional rules
$(1)-clean:
$(RM) $$($(1)_OBJ) $$($(1)_DEP) $(2)/$(1)$(3)