Automatic C++ style for the Math library

Everyone who packages LLVM seems to pick different SVN revisions to distribute as “5.0”, and none of them overlap. It’s kind of amazing, really. I’m not sure why they don’t all just use what LLVM calls it’s 5.0 release. Even LLVM’s own Ubuntu PPAs have a different version for 5.0! This is a situation where they could be doing much better and just aren’t, for whatever reason.

I’m trying to find the versions across homebrew (which uses Google’s stable tags) and LLVM’s PPAs that are closest in functionality (I think that’s 2017-11-14 and 319925, respectively). Let me make sure everyone can get those versions installed.

I will also add server-side formatting commits to this to make builds proceed instead of fail on formatting issues. This will mean the server will run clang-format on your files and commit the results to your branch. This means that if you haven’t set up clang-format locally (or you have a slightly different version) you could have upstream changes waiting for you. If you have clang-format set up locally, you won’t get any. If your versions are slightly off, you should get minimal changes. If you haven’t set up clang-format or any of the editor modes that support it, you will probably get significant changes that could give you merge conflicts if you don’t pull after a push (to a branch with a PR only). This could be a headache but it seems most people want to try this out (@Bob_Carpenter, @sakrejda, @wds15, maybe more). Let’s give it a shot and see what happens. This mix of local and remote might be the best solution for the team since it will let us onboard people relatively easily.

2 Likes

I just merged the pull request to automatically format incoming pull requests on Jenkins, commit the changes either to either the same branch on stan-dev/math or a new one, depending on if we’re dealing with a PR from the main repo or a fork respectively. So if you’re on a fork, you’ll need to pull stan-dev/math autoformat/<your branch name> into your branch. I still think it’s best if people have the hook or editor mode installed locally, but if you don’t this will help the pull requests all be on the same page.

Please let me know if anyone sees anything weird.

2 Likes

which version of clang format should I shoot for now?

I don’t seem to have any trouble at the moment in this regard, but I think my clang format version from macports is not quite the same.

If you can get this one: clang-format version 5.0.1 (tags/RELEASE_501/final) with macports that would be closest, I think.