The Wayback Machine - https://web.archive.org/web/20220707041105/https://github.com/bmorcos/pre-commit-hooks-cpp
Skip to content

bmorcos/pre-commit-hooks-cpp

master
Switch branches/tags
Code

Latest commit

cpplint -> cppcheck

Signed-off-by: Pierre-Jean Texier <[email protected]>
9a5aa38

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

pre-commit hooks for cpp tools

This provides pre-commit hooks for clang-format, cpplint, and cppcheck.

Usage

To use these hooks, simply place the following in you .pre-commit-config.yaml (more details below):

repos:
-   repo: https://github.com/bmorcos/pre-commit-hooks-cpp
    rev: master
    hooks:
    -   id: clang-format
    -   id: cpplint
    -   id: cppcheck

clang-format

This requires clang-format to be installed, e.g. sudo apt install clang-format. The default setup uses the Google style guide and will format all C/C++ files and headers found in the repo, however other arguments and particular files can specified.

-   repo: https://github.com/bmorcos/pre-commit-hooks-cpp
    rev: master
    hooks:
    -   id: clang-format
    #   args: [--option1, -option2=abc]
    #   files: my_file.cpp|my_other_file.cpp

cpplint

This requires cpplint to be installed, e.g. pip install cpplint. The default setup uses the --verbose=3 flag and will check all C/C++ files and headers found in the repo, however other arguments and particular files can specified.

-   repo: https://github.com/bmorcos/pre-commit-hooks-cpp
    rev: master
    hooks:
    -   id: cpplint
    #   args: [--option1, -option2=abc]
    #   files: my_file.cpp|my_other_file.cpp

cppcheck

This requires cppcheck to be installed, e.g. sudo apt install cppcheck. The default setup enables warnings to be displayed and will check all C/C++ files and headers found in the repo, however other arguments and particular files can specified.

-   repo: https://github.com/bmorcos/pre-commit-hooks-cpp
    rev: master
    hooks:
    -   id: cppcheck
    #   args: [--option1, -option2=abc]
    #   files: my_file.cpp|my_other_file.cpp

About

Configure some pre-commit hooks for some c++ tools

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages