Add support for OCLint static checker.

This commit is contained in:
John Hood
2017-08-06 22:00:24 -04:00
parent 4f068d7261
commit 9df71ae5ad
+18 -1
View File
@@ -7,6 +7,14 @@ AM_DISTCHECK_CONFIGURE_FLAGS = --enable-compile-warnings=distcheck --enable-exam
# non-Automake defines # non-Automake defines
CPPCHECK_FLAGS = --enable=all --template=gcc --force # -j8 disables unused function checking. CPPCHECK_FLAGS = --enable=all --template=gcc --force # -j8 disables unused function checking.
CLANG_SCAN_BUILD = scan-build CLANG_SCAN_BUILD = scan-build
BEAR = bear
OCLINT_JCD = oclint-json-compilation-database
OCLINT_OPTIONS = -enable-global-analysis -max-priority-2=1000 -max-priority-3=1000 \
-rc LONG_LINE=160 \
-rc LONG_VARIABLE_NAME=40 \
-rc SHORT_VARIABLE_NAME=1 \
-rc MINIMUM_CASES_IN_SWITCH=2
.PHONY: VERSION .PHONY: VERSION
VERSION: VERSION:
@@ -29,7 +37,7 @@ version.h: VERSION
@rm -f version.h.new @rm -f version.h.new
clean-local: clean-local:
@rm -rf version.h VERSION cov-int mosh-coverity.txz @rm -rf version.h VERSION cov-int mosh-coverity.txz compile_commands.json
# Linters and static checkers, for development only. Not included in # Linters and static checkers, for development only. Not included in
# build dependencies, and outside of Automake processing. # build dependencies, and outside of Automake processing.
@@ -47,6 +55,15 @@ cov-build:
cov-build --dir cov-int $(MAKE) check TESTS= cov-build --dir cov-int $(MAKE) check TESTS=
tar -caf mosh-coverity.txz cov-int tar -caf mosh-coverity.txz cov-int
# These two rules are for Bear + OCLint.
# Don't *run* the tests, prediction-unicode.test generates arguments
# with illegal UTF-8 that make Bear unhappy.
compile_commands.json:
$(MAKE) clean
bear $(MAKE) check TESTS=
oclint: compile_commands.json
$(OCLINT_JCD) -e src/protobufs -- $(OCLINT_OPTIONS)
# Clang's scan-build static checker. # Clang's scan-build static checker.
scan-build: scan-build:
$(MAKE) clean $(MAKE) clean