This applies to anyone developing on the Stan Math library.
For our style guide, see the wiki page on Coding Style and Idioms.
Instructions for setting up clang format and git (from the pull request):
Emacs - there’s a plugin/script called
google-c-style. You can find it here or just install from MELPA.
Spacemacs - you can add
Vim- check out https://github.com/google/vim-codefmt
There is a pre-commit hook in hooks/pre-commit, and if you run
bash hooks/install_hooks.sh it will be installed for you. Going forward, it will run
clang-format -i (which implicitly uses the
.clang-format file in the repo) on any changed files to format them. If you need to disable this for some reason (though your tests will fail if you haven’t formatted things correctly) you can use
git commit --no-verify.