Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the clang-tidy is a clang-based C++ “linter” tool. #295

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
16 changes: 16 additions & 0 deletions tests/clang_tidy/test_clang_tidy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/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/
CHECKS="-checks=*,-fuchsia-*"
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 -DCMAKE_CXX_CLANG_TIDY=${CLANG_TIDY_FLAGS} -DFACELIFT_BUILD_TESTS=ON ${DIR_SRC} && cmake --build ${DIR_BUILD} 2>$REPORT_ANALYZER
# Show reports
echo "clang-tidy report generated: "$REPORT_ANALYZER