I am trying to add isort
, black
and flake8
into my project's pre-commit
hooks, it works fine when I edit one single file.
What I want to achieve is isort
one directory of the project by isort -rc .
and push the changes to remote repository but it gives me Everything up-to-date
but when I check git status
it shows me all modifications.
Can someone help figure out what I have done wrong? Below I post the screenshot and code snippets. Thanks!
ā¢100% ā git status On branch 2020-01-29-test-pre-commit Your branch is up to date with 'origin/2020-01-29-test-pre-commit'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: athlete_report/algorithm/yazs/cc_calculation_copy.py
modified: athlete_report/algorithm/yazs/dto/session_event.py
modified: athlete_report/algorithm/yazs/formula/flow_processor.py
modified: athlete_report/algorithm/yazs/input/flow_input_processor.py
modified: athlete_report/algorithm/yazs/input/single_source_handler.py
modified: athlete_report/algorithm/yazs/input/two_sources_handler.py
modified: athlete_report/algorithm/yazs/vertical_jump/vert_jump.py
modified: athlete_report/algorithm/yazs/yazs_calculation.py
modified: athlete_report/pdf_generator/athlete_report_builder.py
(mbp37)
src on ī 2020-01-29-test-pre-commit [+] via š
mbp37
ā¢100% ā git add .
(mbp37)
src on ī 2020-01-29-test-pre-commit [+] via š
mbp37
ā¢100% ā git commit -am "add modifications to athlete report"
seed isort known_third_party.............................................Passed
isort....................................................................Failed
- hook id: isort
- files were modified by this hook
Fixing /Users/hzhang/Work/yana-motion-lab/report-engine/src/athlete_report/pdf_generator/athlete_report_builder.py
black....................................................................Failed
- hook id: black
- files were modified by this hook
reformatted /Users/hzhang/Work/yana-motion-lab/report-engine/src/athlete_report/pdf_generator/athlete_report_builder.py
All done! āØ š° āØ
1 file reformatted, 8 files left unchanged.
Flake8...................................................................Passed
(mbp37)
src on ī 2020-01-29-test-pre-commit [+] via š
mbp37 took 3s
ā¢100% ā git diff
(mbp37)
src on ī 2020-01-29-test-pre-commit [+] via š
mbp37
ā¢100% ā git push
Everything up-to-date
(mbp37)
src on ī 2020-01-29-test-pre-commit [+] via š
mbp37 took 2s
ā¢100% ā git diff
Because changes were made by pre-commit
the commit was cancelled (as the contents were not correct to be committed)
You'll want to review the changes being made (git status
/ git diff
) and if the automatic changes made by the tools look correct you'll then git add -u
and re-run your git commit
command (^R
+ git commit
might be helpful here)
there's no commit to push because the commit was cancelled