-
Notifications
You must be signed in to change notification settings - Fork 5
Add pre-commit #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pre-commit #120
Conversation
…file hygiene Implements pre-commit configuration to prevent noisy Jupyter notebook commits and maintain consistent file formatting across the repository. Changes: - Added .pre-commit-config.yaml with nbstripout and general file cleanup hooks - Documented pre-commit setup in docs/src/set_up.md (developer-facing documentation) - Added brief reference in CLAUDE.md pointing to proper documentation The pre-commit hooks automatically: - Strip Jupyter notebook outputs, execution counts, and metadata - Remove trailing whitespace and fix line endings - Validate YAML/TOML syntax - Prevent accidentally committing large files (>5MB) Note: Julia code formatting is handled separately via .JuliaFormatter.toml 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enables automatic Julia code formatting in pre-commit workflow now that JuliaFormatter has been installed globally. Changes: - Added JuliaFormatter.jl hook to .pre-commit-config.yaml - Updated docs/src/set_up.md with JuliaFormatter installation requirement The JuliaFormatter hook formats Julia code according to .JuliaFormatter.toml settings automatically on commit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
I am ok with it being a pre-commit. If someone commits a notebook with outputs still in it, it will be rather obvious during PR review and we can just mention to install the pre-commit package and run from there.
I've been running it here and there on the repo, and I think we definitely need some sort of formatting, especially when it comes to whitespace removal, standardizing spacing in function calls, etc.. I've tried to remember when committing PRs but was not as diligent as I wanted and ended up committing changes that haven't been formatted and then not wanting to do an entirely separate PR to just do formatting, so I think auto-running this is a great idea. I think the requirement should just be to run the Julia formatter to catch bad formatting and not directly prescribe anything major that developers need to consider. This JuliaFormatter.toml file was directly copied from the FUSE repo in #40, and I think it works pretty well to clean up the code |
Code Review for PR #120: Add pre-commit hooksSummaryThis PR adds pre-commit hooks for notebook cleaning and Julia code formatting. The implementation is straightforward and will be useful for maintaining code consistency and reducing notebook noise in commits. Code Quality & Best PracticesStrengths:
Issues & Suggestions:
Documentation Issues
Testing Considerations
Overall AssessmentThe PR accomplishes its goals and is well-documented. Main issues: version mismatches, potential idempotency issues with hook ordering, and minor documentation clarity around JuliaFormatter installation. Recommendation: Request changes to address Python version mismatch, update pre-commit-hooks version, and verify hook idempotency before merging. Action Items:
|
|
@matt-pharr @JaeBeom1019 @mfairborn23 @satelite2517 please consider initializing these precommits as per the instructions. it will be helpful if we all confirm to the same formatting |
This branch adds a pre-commit yml file that cleans up the notebook meta data and outputs so we stop recording silly changes whenever anyone runs a notebook.
I made it a pre-commit so developers have to opt in by installing the pre-commit functionality and initializing it for their local repo. The alternative is to make it a hook, which would then be forced on anyone making any commit... I am open to thoughts on wether we should switch to this strict approach.
I also added a Julia Formatter. I think it would be valuable to enforce a standard of formatting, which makes the code more coherent and readable. I don't want to be overly prescriptive, but some consistent basics are good imo. I am also open to thoughts on this: should we add more prescriptions? Make it less prescriptive? Not use it?