Skip to content

config file in readme no longer works for pre-commit version >= 3 #98

@ruwfr

Description

@ruwfr

The demo config in the readme is formated as a list with a single item. Running it using a version of pre-commit >= 3 results in the following error:

An error has occurred: InvalidConfigError:
==> File .pre-commit-config.yaml
=====> Expected a Config map but got a list

pre-commit version 3 dropped support for the list format. The issue is described here: https://stackoverflow.com/questions/75216436/pre-commit-is-failing-with-expected-a-config-map-but-got-a-list

Running pre-commit migrate-config migrates the config to:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.6.5
  hooks:
    # Run the linter.
    - id: ruff
      args: [ --fix ]
    # Run the formatter.
    - id: ruff-format

which works just fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions