Skip to content

Commit

Permalink
Added linting github action (#2)
Browse files Browse the repository at this point in the history
* feat: Added linting github action

* fix: Fix buggy c_lint.yaml

* test: Bad linting

* feat: Update c_lint.yaml to fail job if there are linting errors

* fix:  Fix buggy c_lint.yaml

* fix: Add missing { to c_lint.yaml

* fix: Opposite behavior in c_lint.yaml
  • Loading branch information
niklas-vainio authored Oct 7, 2024
1 parent c15a0c8 commit 84d1573
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/c_lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: C/C++ Lint Check
on: [push]
jobs:
Lint-Check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checking for linter errors
uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: 'file' # Use .clang-format config file
tidy-checks: '-*' # Disable clang-tidy
# only 'update' a single comment in a pull request's thread.
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
format-review: true
passive-reviews: true
- name: Fail if there are linter errors
if: ${{steps.linter.outputs.clang-format-checks-failed}}
run: |
echo "Linter errors occurred, failing the job."
exit 1 # This will cause the step to fail
3 changes: 3 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ slate_t slate;
*/
int main()
{
// Some ugly code with linter errors
int x = 10
+ 5;
stdio_init_all();

/*
Expand Down

0 comments on commit 84d1573

Please sign in to comment.