Giter Club home page Giter Club logo

unformat's Introduction

Python3 utility to generate a .clang-format file from example code-base.

Description

Given the path to a C, C++ or Objective-C project, attempts to generate the perfect .clang-format file. It does this by producing configuration files with random variations and measuring how much code they would change. Finally the configuration file with the least change is output.

Dependencies

Tested under Python 3.5 using clang-format 3.9 and clang-format 3.8.

Python modules you'll need to install:

To add dependencies to a Ubuntu or Debian system:

sudo apt install clang-format python3-levenshtein python3-yaml

Examples

If Unformat is cloned into /home/abc/unformat and C++ source code is in /home/abc/my_project,

python3 /home/abc/unformat --root /home/abc/my_project /home/abc/my_project/**/*.h /home/abc/my_project/**/*.cpp

will search for the best .clang-format file. It will start searching from /home/abc/my_project/.clang-format and will write new configurations to that location as they are found. (Note you must have globstar enabled to make use of recursive (**) wildcards.)

The search may continue indefinitely. Press Ctrl-C to stop early. Any intermediate results will be written out.

Links

To submit feedback and bug reports, please file an issue.
For another solution to this problem, check out whatstyle.

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.