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

mapping values are not allowed here #44

Open
bilyboy785 opened this issue Nov 30, 2022 · 1 comment
Open

mapping values are not allowed here #44

bilyboy785 opened this issue Nov 30, 2022 · 1 comment

Comments

@bilyboy785
Copy link

bilyboy785 commented Nov 30, 2022

Pre-commit-config :

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
  rev: 0.2.2
  hooks:
  - id: yamlfmt
    name: YAML FMT
    args: [--mapping, '2', --sequence, '2', --offset, '0', --width, '250']

Example YAML file with indentation problem :

images:
    - name: eu.gcr.io/xxxxxxxxxx/xxxx/xxxxxxxxxxx/xxxxxxxx
         newTag: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Error when i commit :

YAML FMT.................................................................Failed
- hook id: yamlfmt
- exit code: 1

api-medicaments/overlays/dev/kustomization.yamlTraceback (most recent call last):
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/bin/yamlfmt", line 181, in <module>
    FORMATTER.format(file_name)
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/bin/yamlfmt", line 137, in format
    FORMATTER.parse_file(path)
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/bin/yamlfmt", line 147, in parse_file
    self.content = list(self.yaml.load_all(stream))
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/main.py", line 461, in load_all
    yield constructor.get_data()
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/constructor.py", line 114, in get_data
    return self.construct_document(self.composer.get_node())
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/composer.py", line 66, in get_node
    return self.compose_document()
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/composer.py", line 99, in compose_document
    node = self.compose_node(None, None)
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/composer.py", line 143, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/composer.py", line 223, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/composer.py", line 141, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/composer.py", line 185, in compose_sequence_node
    node.value.append(self.compose_node(node, index))
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/composer.py", line 143, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/composer.py", line 223, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/composer.py", line 113, in compose_node
    if self.parser.check_event(AliasEvent):
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/parser.py", line 146, in check_event
    self.current_event = self.state()
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/parser.py", line 630, in parse_block_mapping_value
    if self.scanner.check_token(ValueToken):
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/scanner.py", line 1796, in check_token
    self._gather_comments()
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/scanner.py", line 1838, in _gather_comments
    self.fetch_more_tokens()
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/scanner.py", line 288, in fetch_more_tokens
    return self.fetch_value()
  File "/Users/mbouillaud/.cache/pre-commit/repoge4is5u9/py_env-python3.10/lib/python3.10/site-packages/ruamel/yaml/scanner.py", line 657, in fetch_value
    raise ScannerError(
ruamel.yaml.scanner.ScannerError: mapping values are not allowed here
  in "api-medicaments/overlays/dev/kustomization.yaml", line 20, column 15
@mglants
Copy link

mglants commented Feb 1, 2023

+1

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

No branches or pull requests

2 participants