GithubHelp home page GithubHelp logo

yirkha / uncrustify Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uncrustify/uncrustify

0.0 0.0 0.0 5.72 MB

Code beautifier

Home Page: http://uncrustify.sourceforge.net/

License: GNU General Public License v2.0

CMake 0.74% Shell 0.58% JavaScript 0.23% Python 1.71% Batchfile 0.22% C++ 60.51% Perl 0.10% Awk 0.02% C 20.25% Objective-C 3.43% Objective-C++ 0.16% Smalltalk 0.06% C# 0.69% D 10.44% Java 0.30% MATLAB 0.03% OpenEdge ABL 0.15% SourcePawn 0.07% Vala 0.31%

uncrustify's Introduction

README for Uncrustify

Travis CI AppVeyor Coverity

Post any bugs to the issue tracker found on the project's GitHub page: https://github.com/uncrustify/uncrustify/issues

Please include the following with your issue:

  • a description of what is not working right
  • input code sufficient to demonstrate the issue
  • expected output code
  • configuration options used to generate the output

If the issue cannot be easily reproduced, then it isn't likely to be fixed.

Building using CMake

CMake is a tool that generates build systems (Makefiles, Visual Studio project files, and others).

To generate a build system for Uncrustify using CMake, create a build folder and run CMake from it:

$ mkdir build
$ cd build
$ cmake ..

Then use the build tools of your build system (in many cases this will simply be make, but on Windows it could be MSBuild or Visual Studio). Or use CMake to invoke it:

$ cmake --build .

If testing is enabled, CMake generates a test target, which you can build using your build system tools (usually make test). This can also be invoked using CTest:

$ ctest -V -C Debug

There is also an install target, which can be used to install the Uncrustify executable (typically make install).

A note on CMake configurations

Some build systems are single-configuration, which means you specify the build type when running CMake (by setting the CMAKE_BUILD_TYPE variable), and the generated files then build that configuration.

An example of a single-configuration build system is Makefiles. You can build the Release configuration of Uncrustify (from the build folder) with:

$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make

Other build systems are multi-configuration, which means you specify the build type when building.

An example of a multi-configuration build system is Visual Studio project files. When you open the project in Visual Studio, you can select which configuration to build. You can also do this while building from the command line with cmake --build . --config Release.

Building the program using Xcode on Mac OS X

Use cmake with Xcode generator to generate Xcode project.

cmake -G Xcode ..

Configuring the program

Examine the example config files in etc (such as ben.cfg) and/or read configuration.txt. Copy the existing config file that closely matches your style and put in ~/.uncrustify/. Find complete configuration file options in this file. Modify to your liking.

Running the program (and refining your style)

As of the current release, I don't particularly trust this program to not make mistakes and screw up my whitespace formatting.

Here's how to run it:

$ uncrustify -c ~/.uncrustify/mystyle.cfg -f somefile.c > somefile.c.unc

The -c option selects the configuration file. The -f option specifies the input file. The output is sent to stdout. Error messages are sent to stderr.

Use a quality side-by-side diff tool to determine if the program did what you wanted. Repeat until your style is refined.

Running the program (once you've found your style)

Write a script to automate the above. Check out etc/dofiles.sh for an example. That script is used as follows:

  1. navigate one level above your project
  2. make a list of file to process
$ find myproj -name "*.[ch]" > files.txt
  1. $ sh etc/dofiles.sh files.txt
  2. Use your favorite diff/merge program to merge in the changes
$ xxdiff out/myproj myproj

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.