Low commit activity in last 3 years
No release in over a year
Pronto runner for clang-format, a tool to reformat C++ sources files according to configurable style guides.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.0
~> 3.4
~> 2.4.3

Runtime

< 0.12.0
 Project Readme

Pronto runner for clang-format

Code Climate Build Status Gem Version

Pronto runner for clang-format, a tool to reformat C/C++/Java/JavaScript/Objective-C/Protobuf code according to configurable style guidelines. What is Pronto?

As an example, this can be used to run clang-format and submit replacements to web-based git repo managers (e.g. github, gitlab, ...) as comments using Pronto.

Installation:

First, the following prerequisites need to be installed:

  1. clang-format
  2. Ruby
  3. Pronto, this can be done after installing Ruby using:
    gem install pronto
    

After that, pronto-clang_format can be installed using:

gem install pronto-clang_format

Pronto will detect and run clang-format as soon as this runner is installed.

Configuration:

The runner can be configured by setting some environment variables before invoking it. The following table lists these environment variables along with a description for each one of them:

Environment variable Description
PRONTO_CLANG_FORMAT_PATH Path to the clang-format executable that should be run by the runner. This defaults to clang-format
PRONTO_CLANG_FORMAT_STYLE A string that is passed to clang-format's --style= option. This defaults to file
PRONTO_CLANG_FORMAT_FILE_EXTS A comma separated list of file extensions to examine. This defaults to c, h, cpp, cc, cxx, c++, hh, hxx, hpp, h++, icc, inl, tcc, tpp, ipp

Known limitations:

  • Every replacement reported by clang-format is mapped to no more than one offence, even though the reported replacement might be fixing more than one offence (e.g. trailing whitespace in a line and improper indentation in the following line)
  • Only one offence is reported per line; to avoid overwhelming one line with too many offences
  • Categorizers are rudimentary, but more can be added easily to the current chain
  • This runner is mostly meant to remind the developer to run clang-format on his changed files. It is not about going through the offences one by one and fixing them manually