Commit blocked by hassfest hook, but all Integrations is valid

Here is the log of git commit:

[INFO] Stashing unstaged files to /root/.cache/pre-commit/patch1633773739-48786.
pyupgrade................................................................Passed
black....................................................................Passed
codespell................................................................Passed
flake8...................................................................Passed
bandit...................................................................Passed
isort....................................................................Passed
Check JSON...............................................................Passed
Don't commit to branch...................................................Passed
yamllint.............................................(no files to check)Skipped
mypy.....................................................................Passed
gen_requirements_all.....................................................Passed
hassfest.................................................................Failed
- hook id: hassfest
- files were modified by this hook

Validating json... done in 0.00s
Validating codeowners... done in 0.00s
Validating config_flow... done in 0.46s
Validating dependencies... done in 21.49s
Validating manifest... done in 0.08s
Validating mqtt... done in 0.00s
Validating services... done in 9.48s
Validating ssdp... done in 0.00s
Validating translations... done in 4.37s
Validating zeroconf... done in 0.00s
Validating dhcp... done in 0.00s
Validating coverage... done in 2.07s
Validating mypy_config... done in 0.02s

Integrations: 1007
Invalid integrations: 0

[WARNING] Stashed changes conflicted with hook auto-fixes... Rolling back fixes...
[INFO] Restored changes from /root/.cache/pre-commit/patch1633773739-48786.

Anyone can help me ?

Run hassfest python3 -m script.hassfest

Here is the output :

# python3 -m script.hassfest
Validating json... done in 0.00s
Validating codeowners... done in 0.02s
Validating config_flow... done in 1.31s
Validating dependencies... done in 36.01s
Validating manifest... done in 0.12s
Validating mqtt... done in 0.01s
Validating services... done in 25.04s
Validating ssdp... done in 0.01s
Validating translations... done in 11.54s
Validating zeroconf... done in 0.00s
Validating dhcp... done in 0.01s
Validating coverage... done in 3.69s
Validating mypy_config... done in 0.09s

Integrations: 1007
Invalid integrations: 0

@ludeeus Can you help me?

Just ran into this issue myself and here is what to do!

This occurs because the hassfest script has modified a file that is not part of your current change-set. This is a little annoying as it’s really hard to tell what has changed when the output states everything is good.

Fortunately pre-commit does have a way to help. Run the following command:

./script/run-in-env.sh pre-commit run --show-diff-on-failure

This will run the pre-commit commands but before pre-commit rolls back the GIT state a diff will be printed showing what was changed. In my case it was the CODEOWNERS file. Add the additional file into your staged commit and the commit should pass successfully.

I’m on the same page, I don’t know how to fix the don't commit to branch issue. Any help will be appreciated!

I don’t know exactly if what I did was “right”, but this is what I did:

  1. I created a branch using git branch -c <my new branch name
  2. I switched to my branch clicking on the “dev” name down left of vscode
  3. I run git push origin HEAD as suggested by a failed git push
  4. I finally run git commit -m "my message" to commit on my branch.

I’m not 100% sure what I did is correct, but I think I was able to save my work on a branch of HA core so I could do a PR later.

1 Like