Skip to content

Commit

Permalink
Added clang-tidy GitHub action
Browse files Browse the repository at this point in the history
Created clang-tidy.yml
Renamed lint.yml to clang-format.yml
  • Loading branch information
zjeffer committed Dec 20, 2023
1 parent f5370fc commit c1a7710
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linter
name: clang-format

on: [push, pull_request]

Expand All @@ -8,7 +8,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: DoozyX/[email protected]
name: clang-format
with:
source: '.'
extensions: 'hpp,h,cpp,c'
clangFormatVersion: 16
clangFormatVersion: 16
31 changes: 31 additions & 0 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: clang-tidy

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
container:
image: alexays/waybar:debian
steps:
- uses: actions/checkout@v3
- name: configure
run: |
meson -Dcpp_std=c++20 build # necessary to generate compile_commands.json
ninja -C build # necessary to find certain .h files (xdg, wayland, etc.)
- uses: zjeffer/cpp-linter-action@test/process-compilation-database
name: clang-tidy
id: clang-tidy-check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PIP_NO_CACHE_DIR: false
with:
style: "" # empty string => don't do clang-format checks here, we do them in clang-format.yml
files-changed-only: true # only check files that have changed
lines-changed-only: true # only check lines that have changed
tidy-checks: "" # empty string => use the .clang-tidy file
version: "17" # clang-tools version
database: "build" # path to the compile_commands.json file
- name: Check if clang-tidy failed on any files
if: steps.clang-tidy-check.outputs.checks-failed > 0
run: echo "Some files failed the linting checks!" && exit 1
2 changes: 1 addition & 1 deletion src/modules/hyprland/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Workspaces::Workspaces(const std::string &id, const Bar &bar, const Json::Value
}
event_box_.add(m_box);

if (!gIPC) {
if (!gIPC.get()) {
gIPC = std::make_unique<IPC>();
}

Expand Down

0 comments on commit c1a7710

Please sign in to comment.