Skip to content

Commit

Permalink
update for clang-tidy
Browse files Browse the repository at this point in the history
Use `clang` compiler instead of `gcc`.
Remove ansi color from `run-clang-tidy` result.

Signed-off-by: Inho Oh <inho.oh@sk.com>
  • Loading branch information
webispy committed Nov 2, 2023
1 parent 8ae9848 commit 227e61c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ RUN apt-get update \
&& apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
automake \
clang-format clang-tidy clang-tools \
clang clang-format clang-tidy clang-tools \
colorized-logs \
cppcheck \
debianutils \
debhelper \
Expand All @@ -24,7 +25,7 @@ RUN apt-get update \
gstreamer1.0-pulseaudio \
iputils-ping \
jq \
rapidjson-dev \
rapidjson-dev \
less \
libnugu-epd-dbg \
libnugu-kwd-dbg \
Expand All @@ -48,7 +49,7 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY dotfiles/.vimrc dotfiles/.zshrc dotfiles/.tigrc /root/
COPY dotfiles/.vimrc dotfiles/.zshrc dotfiles/.tigrc dotfiles/.clang-tidy /root/
COPY run_codechecker run_codereview.sh /usr/bin/
COPY patches/* /tmp/
COPY install_ddebs.sh /usr/bin/
Expand All @@ -71,4 +72,5 @@ RUN git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh --depth
&& rm /tmp/*.patch \
&& cd /tmp && git clone https://github.com/webispy/mdbus.git && cd mdbus \
&& ./autogen.sh --prefix=/usr && make install \
&& rm -rf /tmp/mdbus
&& rm -rf /tmp/mdbus \
&& cp /root/.clang-tidy /
19 changes: 19 additions & 0 deletions dotfiles/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Default
# - Disable all
# Enable
# - clang*
# - perf*
# - cert*
# Exclude
# - performance-no-int-to-ptr
# - cert-dcl37-c
# - cert-dcl51-cpp
Checks: '-*,
clang*,
perf*,
cert*,
-performance-no-int-to-ptr,
-cert-dcl37-c,
-cert-dcl51-cpp'
CheckOptions:
InheritParentConfig: true
17 changes: 6 additions & 11 deletions run_codereview.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
#!/bin/sh

mkdir -p temp_build
cd temp_build
#!/bin/bash

CLANG_RESULT_FILE="result.log"
CHECKER_REPORT_FILE="report.json"

echo "step-1. generate compile_commands.json"
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../ > /dev/null
cmake -S . -B temp_build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ > /dev/null
cp temp_build/compile_commands.json .

echo "step-2. run clang-tidy tools"
run-clang-tidy -checks='-*,clang*,perf*,cert*' > $CLANG_RESULT_FILE
run-clang-tidy | tee >(ansi2txt > $CLANG_RESULT_FILE)

echo "step-3. run code checker"
echo "step-3. run code checker and generate $CHECKER_REPORT_FILE"
set -e
run_codechecker $CLANG_RESULT_FILE $@

echo "step-4. codechecker report generate to $CHECKER_REPORT_FILE"
mv $CHECKER_REPORT_FILE ..

cd ..
echo "step-4. remove temp build directory"
rm -rf temp_build

0 comments on commit 227e61c

Please sign in to comment.