Skip to content

Commit

Permalink
Add the clang-tidy is a clang-based C++ “linter” tool.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalii Arteev committed Sep 14, 2020
1 parent 13dc426 commit 2f55ea3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/clang_tidy/read.me
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# clang-tidy is a clang-based C++ “linter” tool.

# source code: https://llvm.org/docs/GettingStarted.html#checkout
# docs: http://clang.llvm.org/extra/clang-tidy/
# install clang-tidy, clang-tools using apt-get:
$ sudo apt install clang-tidy clang-tools

# How to use
Create a build folder and jump into it:
$ mkdir build && cd "$_"
Run the script:
$ facelift/tests/clang_tidy/test_clang_tidy.sh
Results of analysis will be available in the folder
$ clang_tidy/report_yy-mm-dd-hhmmss/report
15 changes: 15 additions & 0 deletions tests/clang_tidy/test_clang_tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -eu
# for info see 'read.me'

DIR_BUILD=$PWD
DIR_SRC=$(cd $(dirname "$0")/../..; pwd -P)
DIR_REPORT="$DIR_BUILD/clang-tidy/report_$(date +"%y-%m-%d-%H%M%S")"
REPORT_ANALYZER="$DIR_REPORT/report"
# Use -checks=* to see all available checks. See more settings: https://clang.llvm.org/extra/clang-tidy/
CLANG_TIDY_FLAGS="clang-tidy;-extra-arg=-std=c++14;-header-filter=.*;-p=${DIR_BUILD};-checks=*"
# Build facelift with flags
mkdir -p $DIR_REPORT
cmake -DFACELIFT_BUILD_TESTS=ON -DCMAKE_CXX_CLANG_TIDY=${CLANG_TIDY_FLAGS} ${DIR_SRC} && cmake --build ${DIR_BUILD} 2>$REPORT_ANALYZER
# Show reports
echo "clang-tidy report generated: "$REPORT_ANALYZER

0 comments on commit 2f55ea3

Please sign in to comment.