cpp-lint-action is a tool used to check C++ code quality in Github workflow. It relies on several code static analysis tools, supports multiple platforms, and presents the results in various forms.
cpp-lint-action supports several C++ static code analysis tools. Currently, it supports clang-format and clang-tidy, and future versions will support cpplint and cppcheck. Both clang-format and clang-tidy have been verified to work on the Ubuntu versions currently supported by GitHub, so you can use them with confidence. You can find detailed supported platform and tools in here.
cpp-lint-action also presents the results in various forms. You can find all forms in here.
Welcome to submit PRs, open issues, and provide usage feedback in the issues.
Use cpp-lint-action on Github workflow is a easy thing.
Just add follow lines to your .github/workflows/your_workflow_name.yml
- uses: emmett2020/cpp-linter@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
After the workflow is complete, you can see the following results displayed in the GitHub pull request review page.
You can find more comprehensive configurations in there and usage examples in the examples/
directory.
- cpp-lint-action needs c++20 standard. Ensure your local compiler version supports it.
- cpp-lint-action now supports Ubuntu only.
- cpp-lint-action has two dependencies. You should install it before compilation.
sudo apt install -y libboost-all-dev libgit2-dev
- Download this repository and build.
git clone https://github.com/emmett2020/cpp-lint-action.git
mkdir build && cd build
cmake ..
make -j`nproc`
- Run unit tests
./build/tests/test
Since cpp-lint-action is used for Github, you must set some environment variables to simulate Github CI environment.
export GITHUB_REPOSITORY="owner/repository"
export GITHUB_TOKEN="your_private_github_token"
export GITHUB_EVENT_NAME=pull_request
export GITHUB_WORKSPACE="/path/to/your/local/repo"
export GITHUB_REF="ref/pull/NUMBER/merge"
export GITHUB_SHA="test_branch_name_in_your_local_repository"
Then, just run cpp-lint-action
./build/cpp-lint-action