Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sarcasm/run-clang-format
A wrapper script around clang-format, suitable for linting multiple files and to use for continuous integration
https://github.com/sarcasm/run-clang-format
clang clang-format clang-tidy continuous-integration
Last synced: about 9 hours ago
JSON representation
A wrapper script around clang-format, suitable for linting multiple files and to use for continuous integration
- Host: GitHub
- URL: https://github.com/sarcasm/run-clang-format
- Owner: Sarcasm
- License: mit
- Created: 2017-09-28T20:25:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-08-20T12:13:31.000Z (over 1 year ago)
- Last Synced: 2025-01-22T14:07:21.849Z (8 days ago)
- Topics: clang, clang-format, clang-tidy, continuous-integration
- Language: Python
- Homepage:
- Size: 101 KB
- Stars: 247
- Watchers: 7
- Forks: 67
- Open Issues: 11
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
=====================
run-clang-format.py
=====================
----------------------------------------------
Lint files and directories with clang-format
----------------------------------------------.. contents::
:local:Introduction
============A wrapper script around clang-format, suitable for linting multiple files
and to use for continuous integration.This is an alternative API for the clang-format command line.
It runs over multiple files and directories in parallel.
A diff output is produced and a sensible exit code is returned... image:: screenshot.png
How to use?
===========Copy `run-clang-format.py `_ in your project,
then run it recursively on directories, or specific files::./run-clang-format.py -r src include foo.cpp
It's possible to exclude paths from the recursive search::
./run-clang-format.py -r \
--exclude src/third_party \
--exclude '*_test.cpp' \
src include foo.cppThese exclude rules can be put in a ``.clang-format-ignore`` file,
which also supports comments.An example configuration is available in this repo::
$ cat .clang-format-ignore
# ignore third_party code from clang-format checks
src/third_party/*Continuous integration
======================Check `.travis.yml <.travis.yml>`_.
For an example of failure in logs, click the badge (build is broken on purpose):
.. image:: https://travis-ci.org/Sarcasm/run-clang-format.svg?branch=master
:target: https://travis-ci.org/Sarcasm/run-clang-formatFAQ
===Can I check only changed files?
-------------------------------No, and this is what this repository was initially about.
However, once working around a few shortcommings of ``git clang-format``,
I opted to try an alternative strategy
which expects the whole project to be correctly formatted.It would make sense to support this feature as well,
so that the coding style does not need to be enforced but merely suggested.