My Workflow
A Github Action for linting C/C++ code integrating clang-tidy and clang-format to collect feedback provided in the form of thread comments and/or annotations.
Submission Category:
Maintainer Must-Haves
Yaml File or Link to Code
cpp-linter / cpp-linter-action
Lint C/C++ code with clang-format and clang-tidy then post annotations, comments, and step summary with results.
C/C++ Linter Action | clang-format & clang-tidy
A Github Action for linting C/C++ code integrating clang-tidy and clang-format to collect feedback provided in the form of annotations, thread comments, and step summary.
Warning
We only support Linux runners using a Debian based Linux OS (like Ubuntu and many others).
MacOS and Windows runners are supported as well.
What's New
v2
- Change action from using docker to composite steps
- improve workflow runs times from 1m 24s (currently) to 6-20s.
- better support for the database input option (which is currently broken with the docker env).
- better support cross-compilation
- better support 3rd party libraries
- Includes many issues and enhancements. See #87 for details.
Refer here for previous versions.
Usage
Note
Python 3.10 needs to be installed in the docker image if your workflow is running jobs in a container (see discussion in #185) Our intention is to synchronize with the default python…
name: cpp-linter
on:
pull_request:
types: [opened, reopened] # let PR-synchronize events be handled by push events
push:
jobs:
cpp-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: file
- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
run: |
echo "Some files failed the linting checks!"
# for actual deployment
# run: exit 1
Additional Resources / Info
https://cpp-linter.github.io/cpp-linter-action/
Example
Annotations
Thread Comment
Top comments (0)