Skip to content

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.

License

Notifications You must be signed in to change notification settings

emmett2020/cpp-lint-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

cpp-lint-action

Ubuntu CI Apache codecov release

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.

Get started

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. output

You can find more comprehensive configurations in there and usage examples in the examples/ directory.

Develop cpp-lint-action

  1. cpp-lint-action needs c++20 standard. Ensure your local compiler version supports it.
  2. cpp-lint-action now supports Ubuntu only.
  3. cpp-lint-action has two dependencies. You should install it before compilation.
sudo apt install -y libboost-all-dev libgit2-dev
  1. Download this repository and build.
git clone https://github.com/emmett2020/cpp-lint-action.git
mkdir build && cd build
cmake ..
make -j`nproc`
  1. Run unit tests
./build/tests/test

How to use cpp-lint-action locally

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

About

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published