Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AStyle usage for consistent code style #108

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
1 participant
@etinquis
Copy link
Contributor

commented Dec 19, 2011

AStyle info can be found at http://astyle.sourceforge.net/.

A sample of the changes it makes can be found at https://gist.github.com/1495012.

You can use the included pre-commit git hook in Tools/githooks/pre-commit by copying it into %MONOCLEDIR%/.git/hooks/, which will automatically format the files you attempt to commit, you can format every .cpp/.h file in the tree by using Tools/AStyle/AStyle -r *.cpp *.h --options=Tools/AStyle/astylerc, or you can do what the githook does and do something similar to the following in windows:

@echo off
FOR /F %%F IN ('git diff-index --diff-filter=ACMR --cached --name-only HEAD') DO (
    echo %%F | findstr /i .cpp > nul 2>&1
    if NOT ERRORLEVEL 1 (
        Tools/AStyle/AStyle %%F --options=Tools\AStyle\astylerc
    )
    echo %%F | findstr /i .h > nul 2>&1
    if NOT ERRORLEVEL 1 (
        Tools/AStyle/AStyle %%F --options=Tools\AStyle\astylerc
    )
)

Needs to be tested on linux and mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.