Skip to content

cloderic/clang_format_check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clang-format check

🚧 Still a work in progress, contributions are welcome 🚧

Build Status

In the spirit of linter and coding style checker such as jshint or jscs, this helper script relies on clang-format to check and report coding style issues in C and C++ codebases.

usage: clang_format_check.py [-h] [-s STYLE]
                             [--success-on-missing-clang-format]
                             file [file ...]

C/C++ formatting check using clang-format

positional arguments:
  file                  Paths to the files that'll be checked (wilcards
                        accepted).

optional arguments:
  -h, --help            show this help message and exit
  -s STYLE, --style STYLE
                        Coding style, pass-through to clang-format's
                        -style=<string>, (default is 'file').
  --success-on-missing-clang-format
                        If set this flag will lead to a success (zero exit
                        status) if clang-format is not available.

Install dependencies

Run the usual pip install -r requirements.txt

Running tests

Simply run nosetests to launch the script on all .cpp files under test/data.

  • All tests are run with the file style, they'll rely on their .clang-format file.
  • All files ending with ...ok.cpp should be valid.
  • All files ending with ...ko.cpp should be invalid, the tool outputs should match the accompanying ...ko.cpp.out.

About

Coding style checker relying on clang-format

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published