macisamuele / language-formatters-pre-commit-hooks

Collection of custom pre-commit hooks.
Apache License 2.0
112 stars 56 forks source link

Could not determine a constructor for the tag '!reference' #229

Open kokorin opened 1 month ago

kokorin commented 1 month ago

We changed Gitlab CI Yaml file and added !reference tag like this:

deploy-dev:
   script:
    - !reference [.deploy, script]
    - other commands

pre-commit run gives the following output:

check yaml...............................................................Failed
- hook id: check-yaml
- exit code: 1

could not determine a constructor for the tag '!reference'
  in ".gitlab-ci.yml", line 194, column 7

I found a recommendation to update ruamel version and added dependencies:

default_install_hook_types: [pre-commit, pre-push]
repos:
  # other repos removed
  - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
    rev: v2.13.0
    hooks:
      - id: pretty-format-yaml
        args: [--autofix, --indent, '2', --offset, '2', --preserve-quotes]
        stages: [commit]
        additional_dependencies:
          - 'ruamel.yaml==0.18.6'
          - 'ruamel.yaml.clib==0.2.8'

Unfortunately that didn't help

Python version 3.9.7