Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid KeyError: 'rev' for special repos #20

Merged
merged 1 commit into from
Jun 9, 2023

Conversation

covracer
Copy link
Contributor

@covracer covracer commented Jun 9, 2023

Description

pre-commit expects rev to be absent for special repo names:

An error has occurred: InvalidConfigError: 
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='local')
=====> Expected rev to be absent when repo is any of ('local', 'meta'), found rev: 'v0.0.0'

Avoid the following exception for these special repo names

Traceback (most recent call last):
  File "/home/christopher.covington/.cache/pre-commit/repoo_r80vol/py_env-python3/bin/piptools_sync", line 8, in <module>
    sys.exit(main())
  File "/home/christopher.covington/.cache/pre-commit/repoo_r80vol/py_env-python3/lib/python3.9/site-packages/piptools_sync/piptools_sync.py", line 468, in main
    yaml_dict = yaml_to_dict(config_file)
  File "/home/christopher.covington/.cache/pre-commit/repoo_r80vol/py_env-python3/lib/python3.9/site-packages/piptools_sync/piptools_sync.py", line 325, in yaml_to_dict
    version = repo["rev"]
KeyError: 'rev'

Checklist - did you ...

  • Add a CHANGELOG entry if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

`pre-commit` expects `rev` to be absent for special repo names:
```
An error has occurred: InvalidConfigError: 
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='local')
=====> Expected rev to be absent when repo is any of ('local', 'meta'), found rev: 'v0.0.0'
```

Avoid the following exception for these special repo names
```
Traceback (most recent call last):
  File "/home/christopher.covington/.cache/pre-commit/repoo_r80vol/py_env-python3/bin/piptools_sync", line 8, in <module>
    sys.exit(main())
  File "/home/christopher.covington/.cache/pre-commit/repoo_r80vol/py_env-python3/lib/python3.9/site-packages/piptools_sync/piptools_sync.py", line 468, in main
    yaml_dict = yaml_to_dict(config_file)
  File "/home/christopher.covington/.cache/pre-commit/repoo_r80vol/py_env-python3/lib/python3.9/site-packages/piptools_sync/piptools_sync.py", line 325, in yaml_to_dict
    version = repo["rev"]
KeyError: 'rev'
```
@Stephen-RA-King Stephen-RA-King merged commit e565909 into Stephen-RA-King:main Jun 9, 2023
@Stephen-RA-King
Copy link
Owner

Avoid KeyError: 'rev' for special repos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants