C++ C D Objective-C Python CMake Other
Latest commit 5983247 Feb 27, 2017 @gmaurel gmaurel committed on GitHub Merge pull request #1036 from guy-maurel/RemoveNewline
Remove or force newline between } and )
Permalink
Failed to load latest commit information.
.github adds ISSUE_TEMPLATE Nov 14, 2016
cmake Prefer mingw-w64 for cross-compile Oct 3, 2016
documentation change some int to unsigned int Dec 19, 2016
emscripten updates the README.md Jan 8, 2017
etc Some of the options (UNUM) where not completely print for the univers… Feb 8, 2017
lnt add explanation about *.lnt files Jan 21, 2017
man Remove old build system files Sep 27, 2016
osx Add missing osx directory. Oct 25, 2009
scripts correct the number of options Feb 21, 2017
src Merge branch 'master' into RemoveNewline Feb 26, 2017
tests Merge branch 'master' into RemoveNewline Feb 26, 2017
.editorconfig Added .editorconfig files that matches current Uncrustify style Jul 22, 2016
.gitattributes Add gitattributes file May 25, 2016
.gitignore pclint check added (implements #940) Jan 20, 2017
.travis.yml scripts was missed Nov 28, 2016
AUTHORS The actual list of collaborators Aug 25, 2016
BUGS Change to GitHub Jul 29, 2016
CMakeLists.txt sort includes with prioritiezed category Jan 24, 2017
CONTRIBUTING.md Update contribute guidelines after receiving feedback Jan 26, 2017
COPYING Import r1644 from subversion Oct 17, 2009
ChangeLog Merge branch 'master' into I-682 Oct 27, 2016
Comments.txt prepare the configuration file for the sources Apr 25, 2016
HELP Change to GitHub Jul 29, 2016
NEWS Import r1644 from subversion Oct 17, 2009
README.md Merge pull request #974 from CDanU/patch-1 Feb 20, 2017
TESTING Tweaks to the TESTING how-to Aug 26, 2011
appveyor.yml invoke ctest to run the tests Aug 11, 2016
commit.log Update ChangeLog and commit.log Feb 3, 2016
coverity.sh Missed an 'exit' when the NOTIFICATION_EMAIL is blank. Jan 26, 2017
coverity.travis.yml Coverity: Add a travis.yml file and script to push code to coverity Jan 26, 2017
extras.vpj Add a few files to the workspace Jan 1, 2013
forUncrustifySources.cfg Introduce more options for the "enum class" statement Feb 13, 2017
forUncrustifySources.txt uncrustify all the sources with forUncrustifySources.cfg Apr 27, 2016
package.json with proposal of CDanU Nov 18, 2016
release-steps.txt update the release text Dec 31, 2016
run_tests.bat ./run_tests.sh and .bat root scripts were unable to locate a relative… Aug 11, 2016
run_tests.sh ./run_tests.sh and .bat root scripts were unable to locate a relative… Aug 11, 2016
uncrustify.vpj Add ability to get config from UNCRUSTIFY_CONFIG env var to win32 Dec 29, 2011
uncrustify.vpw Update SlickEdit project files Oct 9, 2011
working.txt save off work in the freebsd branch Dec 5, 2009

README.md

README for Uncrustify

Travis CI AppVeyor

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
  3. $ sh etc/dofiles.sh files.txt
  4. Use your favorite diff/merge program to merge in the changes $ xxdiff out/myproj myproj