Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pre-commit InvalidConfigError

When I want to commit my changes in the .pre-commit-config.yaml, I get the following error:

An error has occurred: InvalidConfigError: 
==> File .pre-commit-config.yaml
=====> while parsing a block mapping
  in "<unicode string>", line 33, column 3
did not find expected key
  in "<unicode string>", line 34, column 3
Check the log at /Users/name/.cache/pre-commit/pre-commit.log

The lines 33+ are:

- repo: local
  - id: pytest
    name: Run tests (pytest)
    entry: pytest -x
    language: system
    types: [python]
    pass_filenames: false
like image 647
felice Avatar asked May 14 '26 12:05

felice


1 Answers

I missed adding "hooks" to the file, now it works:

- repo: local
  hooks:  # <- this was missing
  - id: pytest
    name: Run tests (pytest)
    entry: pytest -x
    language: system
    types: [python]
    pass_filenames: false
like image 57
felice Avatar answered May 18 '26 07:05

felice



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!