I’ve seen @pmeunier and @flobec creating “rustfmt patches” from times to times. I wonder if we shouldn’t make one last one, then using it systemically before recording any patches.
This way, we will have a more consistent coding style across the pijul source code.
Fortunately, we have hooks to remember to run the script for us:
Create an executable .pijul/hooks/pre-record with the following content:
Question: is it possible to have global template hooks like in git, so that whenever I create a pijul repo that hook is automatically copied inside? (obviously in that case it would need to be more generic, as not all projects are in rust)
I had a look at the rustfmtconfiguration options. I personally prefer the visual options, but I’ve seen the default is block and that it follows one rust official RFC… So if you guys would like to stick to the official guidelines, I am fine with that.
Once we agree, we can add a rustfmt.toml file to the root of the repo, and update the README file accordingly.
If you scroll down, you’ll see that each option has a different default, for example “control_brace_style” is “AlwaysSameLine”, “error_on_line_overflow” is “false”, etc.
Maybe we are not using the same version of rustfmt? Or maybe, my pijul repo was in a strange state, or I used a strange pijul, in order to record this patch. I don’t really know.
I will come back to you if I encounter the issue ever again.
Edit: We definitely don’t have the same rustfmt version.
Even though now we are all using rustfmt, I still get new formatting on supposedly already formatted code. I think it’s because we are using different versions of rustfmt.
With rustup I now have rustfmt 0.4.1-stable, everything is up to date. Seems it depends on the default toolchain? Must be resolved anyway.
On a related note, is it possible to have a pre-push hook that checks if pijul builds before sending to the nest? I think it would be even more useful than the rustfmt hook.