Skip to content

Commit 545a98c

Browse files
author
Vitalii Arteev
committed
Add the clang-tidy is a clang-based C++ “linter” tool.
1 parent 13dc426 commit 545a98c

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

tests/clang_tidy/read.me

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# clang-tidy is a clang-based C++ “linter” tool.
2+
3+
# source code: https://llvm.org/docs/GettingStarted.html#checkout
4+
# docs: http://clang.llvm.org/extra/clang-tidy/
5+
# install clang-tidy, clang-tools using apt-get:
6+
$ sudo apt install clang-tidy clang-tools
7+
8+
# How to use
9+
Create a build folder and jump into it:
10+
$ mkdir build && cd "$_"
11+
Run the script:
12+
$ facelift/tests/clang_tidy/test_clang_tidy.sh
13+
Results of analysis will be available in the folder
14+
$ clang_tidy/report_yy-mm-dd-hhmmss/report
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -eu
3+
# for info see 'read.me'
4+
5+
DIR_BUILD=$PWD
6+
DIR_SRC=$(cd $(dirname "$0")/../..; pwd -P)
7+
DIR_REPORT="$DIR_BUILD/clang-tidy/report_$(date +"%y-%m-%d-%H%M%S")"
8+
REPORT_ANALYZER="$DIR_REPORT/report"
9+
# Use -checks=* to see all available checks. See more settings: https://clang.llvm.org/extra/clang-tidy/
10+
CLANG_TIDY_FLAGS="clang-tidy;-extra-arg=-std=c++14;-header-filter=. -p=${DIR_BUILD};-checks=*;-enable-check-profile"
11+
12+
# Build facelift with flags
13+
mkdir -p $DIR_REPORT
14+
cmake -DCMAKE_CXX_CLANG_TIDY=${CLANG_TIDY_FLAGS} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DFACELIFT_BUILD_TESTS=ON ${DIR_SRC} && cmake --build ${DIR_BUILD} 2>$REPORT_ANALYZER
15+
# Show reports
16+
echo "clang-tidy report generated: "$REPORT_ANALYZER

0 commit comments

Comments
 (0)