Reputation: 69964
I've been using the pre-commit
tool for years! and it's worked great until recently when it started failing with a mysterious error message:
$ pre-commit run flake8 --all-files
An error has occurred: InvalidConfigError:
==> File .pre-commit-config.yaml
=====> Expected a Config map but got a list
Check the log at /home/asottile/.cache/pre-commit/pre-commit.log
how do I fix this?
Upvotes: 12
Views: 3428
Reputation: 69964
your particular case has been warning since july of 2020 with a message similar to this:
$ pre-commit run flake8 --all-files
[WARNING] normalizing pre-commit configuration to a top-level map. support for top level list will be removed in a future version. run: `pre-commit migrate-config` to automatically fix this.
flake8...................................................................Passed
fortunately, even if you've already upgrade to pre-commit 3.0 (which drops support for this format) you can still run pre-commit migrate-config
which will update your configuration to a supported format:
$ pre-commit migrate-config
Configuration has been migrated.
$ pre-commit run flake8 --all-files
flake8...................................................................Passed
disclaimer: I authored pre-commit
Upvotes: 17