Precommit: formatting and creation of notebooks/markdown #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds precommit hooks for
JuliaFormatter
and notebook creation, as well as a check on the formatting in the CI.See here for instructions on how to set it up.
JuliaFormatter hook
I have used the "official"
JuliaFormatter
hook following this.It is not as nice as what I'm used to in python with black, in that a. it checks all files rather than only those that have been modified, and b. it doesn't list the files it had to format.
Not a big issue, as long as everyone uses it the only files that it has to modify should be ones you changed, and if you want to see exactly which, you can just do a
git status
.notebooks hook
I didn't find any existing hook for this, so I created one that just calls the julia script (changing the the overwrite setting to true). It seems to work fine for me.
JuliaFormatter CI
Here I also used the official one. It seems overly complicated to me, going through some code checker service reviewdog. Also it doesn't seem to be working, in that it passed on this PR before I applied any formatting.
Remaining issues