Closed kurtmckee closed 4 months ago
Patch coverage: 80.55%
and project coverage change: +0.01%
:tada:
Comparison is base (
840cd16
) 89.13% compared to head (5246ca2
) 89.14%. Report is 4 commits behind head on master.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
If unfamiliar with pre-commit, you can do the following to test it out:
pip install pre-commit
or using pipx -- which I strongly recommend -- using pipx install pre-commit
)pre-commit install
)What you'll see is that pre-commit runs isort against the one staged file (but not both!), isort lints and fixes the file's imports, and the commit fails. Notably, pre-commit stashes changes temporarily so only what you've staged gets checked.
For example, this is the output I see locally when I rearrange the imports in cli.py
and another file, but only stage cli.py
in a commit:
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to C:\Users\Kurt\.cache\pre-commit\patch1694373671-15164.
check yaml...........................................(no files to check)Skipped
fix end of files.........................................................Passed
mixed line ending........................................................Passed
trim trailing whitespace.................................................Passed
Enforce Python 3.6 idioms................................................Passed
black....................................................................Passed
isort....................................................................Failed
- hook id: isort
- files were modified by this hook
Fixing C:\Users\Kurt\Documents\dev\dotbot\dotbot\cli.py
Check .editorconfig rules................................................Passed
[INFO] Restored changes from C:\Users\Kurt\.cache\pre-commit\patch1694373671-15164.
I have to stage isort's fixes to my commit before I can successfully commit.
Hi Anish! I hope your year is off to a good start!
I'm going to close this PR to reduce cognitive load.
Thanks for your work on dotbot!
git pre-commit hooks can catch linting issues on developer PCs before they're ever committed to the repo. pre-commit is a widely-used tool that allows projects to specify all of the linters they want to run before each commit.
This PR introduces a pre-commit config that will enforce standard text linting; black, isort, and editorconfig linting; and idiomatic Python 3.6+ syntax.
pre-commit install
in the dotbot repo, and from that point forward git will run the tool prior to each commit so the files are linted and auto-fixed.