Automated style checking for OpenFOAM code using Vera++. Note that this is still a work-in-progress and therefore some rules listed in the OpenFOAM Foundation's style guide have not yet been implemented.
First, install vera++
. On Ubuntu:
sudo apt-get install vera++
Next, in the root directory of your project, either clone this repository:
git clone https://github.com/petebachant/foamStyleCheck.git
or add it as a submodule:
git submodule add https://github.com/petebachant/foamStyleCheck.git
Finally, run the style checking script:
./foamStyleCheck/checkStyle
To integrate with Travis CI, this repository can either be added as a submodule
to any OpenFOAM project, as described above, which would allow local testing,
or can be cloned separately as part of the Travis testing process, which is
configured in the repository's .travis.yml
file.
The Travis CI configuration should be modified to ensure vera++
is
installed and the checkStyle
script is run at some phase in the testing
process. If foamStyleCheck
was not added as a submodule, then it must be
cloned by Travis as well. Any style issues will then cause the Travis build to
fail, thereby automating style checking on commits, pull requests, etc.
For an example of the submodule-based workflow, see turbinesFoam.