From 57c1ed11153fa5a1b16ba463949d8ee3f8db321b Mon Sep 17 00:00:00 2001 From: Kylie Smith Date: Mon, 9 Oct 2023 12:31:28 +1000 Subject: [PATCH] Add clang-tidy PR review --- .clang-tidy | 5 +++++ .github/workflows/lint.yml | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .clang-tidy create mode 100644 .github/workflows/lint.yml diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..3b20eef --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,5 @@ +--- +Checks: 'clang-diagnostic-*,clang-analyzer-*,performance-*,portability-*,modernize-use-nullptr' +WarningsAsErrors: '' +HeaderFilterRegex: '' +... \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..5b987d7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,36 @@ +name: Lint +on: [pull_request] + +jobs: + clang-tidy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install clang-tidy + run: | + sudo apt-get update + sudo apt-get install -y cmake g++ gcc libssl-dev prometheus-cpp-dev clang-tidy + + - name: Prepare compile_commands.json + run: | + cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DARDOS_WANT_DB_SERVER=OFF + + - name: Create results directory + run: | + mkdir clang-tidy-result + + - name: Analyze + run: | + git diff -U0 HEAD^ | clang-tidy-diff -p1 -path build -export-fixes clang-tidy-result/fixes.yml + + - name: Post review + uses: platisd/clang-tidy-pr-comments@master + with: + github_token: ${{ github.token }} + clang_tidy_fixes: clang-tidy-result/fixes.yml + request_changes: true + suggestions_per_comment: 10