Skip to content
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

feat: set-up pre-commit hooks for automatic code formatting #1713

Closed
wants to merge 2 commits into from

Conversation

aleaf
Copy link
Contributor

@aleaf aleaf commented Feb 8, 2023

This commit sets up the framework for pre-commit hooks, which can run black and isort (and other tools) each time a commit is made, so that each commit is correctly formatted. More here, and in the contributing instructions.

@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #1713 (6399f47) into develop (2552de5) will increase coverage by 0.0%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           develop   #1713   +/-   ##
=======================================
  Coverage     71.9%   71.9%           
=======================================
  Files          253     253           
  Lines        55891   55891           
=======================================
+ Hits         40202   40206    +4     
+ Misses       15689   15685    -4     
Impacted Files Coverage Δ
flopy/utils/get_modflow.py 63.9% <0.0%> (+0.9%) ⬆️

@wpbonelli
Copy link
Contributor

Auto-linting seems nice from a developer perspective and enforcing format locally could save CI cycles e.g. forgetting to run scripts/pull_request_prepare.py. Could be removed and pre-commit moved from optional to lint dep group if others agree

Copy link
Contributor

@langevin-usgs langevin-usgs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aleaf, thanks for putting this together. It would be very nice to have a way to deal with this. I think everyone gets scolded by the CI linter on a regular basis. A concern, though, is how to keep version numbers up to date with what is running in Actions. For example, will we run into trouble when a new version of black is released?

.pre-commit-config.yaml Show resolved Hide resolved
…(with other install instructions); link back to them in CONTRIBUTING.md. Add note about static package versions in .pre-commit-config.yaml
@aleaf aleaf closed this Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants