Add basic support for arc lint with clang-tidy

Reviewers: mferencevic, msantl

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1975
This commit is contained in:
Teon Banek 2019-04-23 15:05:17 +02:00
parent 9291a5fc4d
commit 4e56673f0d
4 changed files with 51 additions and 0 deletions

9
.arclint Normal file
View File

@ -0,0 +1,9 @@
{
"linters": {
"clang-tidy": {
"type": "script-and-regex",
"script-and-regex.script": "./tools/arc-clang-tidy",
"script-and-regex.regex": "/^(?P<file>.*):(?P<line>\\d+):(?P<char>\\d+): (?P<severity>warning|error): (?P<message>.*)$/m"
}
}
}

29
.clang-tidy Normal file
View File

@ -0,0 +1,29 @@
---
Checks: 'bugprone-*,clang-diagnostic-*,clang-analyzer-*,google-*,google-runtime-references,-google-explicit-constructor,-google-readability-*,performance-*,-performance-unnecessary-value-param'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: none
CheckOptions:
- key: google-readability-braces-around-statements.ShortStatementLines
value: '1'
- key: google-readability-function-size.StatementThreshold
value: '800'
- key: google-readability-namespace-comments.ShortNamespaceLines
value: '10'
- key: google-readability-namespace-comments.SpacesBeforeComments
value: '2'
- key: modernize-loop-convert.MaxCopySize
value: '16'
- key: modernize-loop-convert.MinConfidence
value: reasonable
- key: modernize-loop-convert.NamingStyle
value: CamelCase
- key: modernize-pass-by-value.IncludeStyle
value: llvm
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-use-nullptr.NullMacros
value: 'NULL'
...

View File

@ -64,6 +64,10 @@ add_custom_target(clean_all
# build flags -----------------------------------------------------------------
# Export the compile commands so that we can use clang-tidy. Additional benefit
# is easier debugging of compilation and linker flags.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall \

9
tools/arc-clang-tidy Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash -e
## Run this script through arc lint
if echo "$1" | egrep -q '.(cpp|hpp)$'; then
clang-tidy -quiet -p build "$1"
elif echo "$1" | egrep -q '.lcp$'; then
clang-tidy -quiet -p build "$1.cpp" "$(dirname $1)/$(basename $1 .lcp).hpp"
fi