Code Monkey home page Code Monkey logo

run-clang-format's Introduction

run-clang-format.py

Lint files and directories with clang-format

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.

screenshot.png

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

These 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/*

Check .travis.yml.

For an example of failure in logs, click the badge (build is broken on purpose):

https://travis-ci.org/Sarcasm/run-clang-format.svg?branch=master

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.

run-clang-format's People

Contributors

sarcasm avatar doozyx avatar codebytere avatar cclauss avatar lpmi-13 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.