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