FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

ParserError exception raised for invalid configuration · Issue #2685 · pre-commit/pre-commit · GitHub

Repository navigation

ParserError exception raised for invalid configuration #2685

Description

search you tried in the issue tracker

ParserError and unicode

describe your issue

I executed pre-commit autoupdate with an invalid configuration file (the second - repo is indented incorrectly) and got this error message:

$ pre-commit autoupdate
An unexpected error has occurred: ParserError: while parsing a block mapping
  in "<unicode string>", line 1, column 1
did not find expected key
  in "<unicode string>", line 7, column 1
Check the log at /home/carsten/.cache/pre-commit/pre-commit.log

This is an expected error and I would expect an error message like `Your configuration file "..." is wrongly formatted at . Please review the format of the content.'.

Thank you,
Carsten

pre-commit --version

pre-commit 2.21.0

.pre-commit-config.yaml

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: check-executables-have-shebangs

- repo: https://github.com/shellcheck-py/shellcheck-py
    rev: v0.9.0.2
    hooks:
    -   id: shellcheck

~/.cache/pre-commit/pre-commit.log (if present)

version information

pre-commit version: 2.21.0
git --version: git version 2.35.3
sys.version:
    3.10.8 (main, Oct 28 2022, 17:28:32) [GCC]
sys.executable: /home/carsten/virtualenv/bin/python3.10
os.name: posix
sys.platform: linux

error information

An unexpected error has occurred: ParserError: while parsing a block mapping
  in "<unicode string>", line 1, column 1
did not find expected key
  in "<unicode string>", line 7, column 1
Traceback (most recent call last):
  File "/home/carsten/virtualenv/lib64/python3.10/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/home/carsten/virtualenv/lib64/python3.10/site-packages/pre_commit/main.py", line 355, in main
    return autoupdate(
  File "/home/carsten/virtualenv/lib64/python3.10/site-packages/pre_commit/commands/autoupdate.py", line 154, in autoupdate
    migrate_config(config_file, quiet=True)
  File "/home/carsten/virtualenv/lib64/python3.10/site-packages/pre_commit/commands/migrate_config.py", line 47, in migrate_config
    contents = _migrate_map(contents)
  File "/home/carsten/virtualenv/lib64/python3.10/site-packages/pre_commit/commands/migrate_config.py", line 16, in _migrate_map
    if isinstance(yaml_load(contents), list):
  File "/home/carsten/virtualenv/lib64/python3.10/site-packages/yaml/__init__.py", line 81, in load
    return loader.get_single_data()
  File "/home/carsten/virtualenv/lib64/python3.10/site-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "yaml/_yaml.pyx", line 673, in yaml._yaml.CParser.get_single_node
  File "yaml/_yaml.pyx", line 687, in yaml._yaml.CParser._compose_document
  File "yaml/_yaml.pyx", line 731, in yaml._yaml.CParser._compose_node
  File "yaml/_yaml.pyx", line 847, in yaml._yaml.CParser._compose_mapping_node
  File "yaml/_yaml.pyx", line 860, in yaml._yaml.CParser._parse_next_event
yaml.parser.ParserError: while parsing a block mapping
  in "<unicode string>", line 1, column 1
did not find expected key
  in "<unicode string>", line 7, column 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL