Skip to content

Fails on YAML open tag. #17

Description

@bmmcwhirt

Valid YAML starts with a first line "---" (three hyphens)
https://yaml.org/spec/1.2.2/#22-structures

No -v or --version arguments.

pip show yamldoc
Name: yamldoc
Version: 0.2.0
Summary: Documentation engine for YAML.
Home-page:
Author: Chris Cole
Author-email: ccole@well.ox.ac.uk
License:
Location: /Users/cn263376/.pyvenv/dev/lib/python3.11/site-packages
Requires:
Required-by:

YAML that passes:

include:
  - template: Security/SAST.gitlab-ci.yml
  - template: Security/Dependency-Scanning.gitlab-ci.yml

YAML that fails:

---
include:
  - template: Security/SAST.gitlab-ci.yml
  - template: Security/Dependency-Scanning.gitlab-ci.yml

Debug output:

yamldoc -d test.yaml
# Configuration Parameters Reference

Any information about this page goes here.

---
@	Found 0 indent level.
Traceback (most recent call last):
  File "/Users/cn263376/.pyamldoc -d test.yaml
# Configuration Parameters Reference

Any information about this page goes here.

---
@	Found 0 indent level.
Traceback (most recent call last):
  File "/{{REDACTED}}/yamldoc", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/{{REDACTED}}/site-packages/yamldoc/cli.py", line 32, in cli
    yamldoc.main(**(vars(args)))
  File "/{{REDACTED}}/site-packages/yamldoc/parser.py", line 554, in main
    yaml = parse_yaml(yaml_path, char, debug, exclude_char, override_exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/{{REDACTED}}1/site-packages/yamldoc/parser.py", line 129, in parse_yaml
    key, value = line.rstrip().split(":", 1)
    ^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)yvenv/dev/bin/yamldoc", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/{{REDACTED}}/site-packages/yamldoc/cli.py", line 32, in cli
    yamldoc.main(**(vars(args)))
  File "/{{REDACTED}}/site-packages/yamldoc/parser.py", line 554, in main
    yaml = parse_yaml(yaml_path, char, debug, exclude_char, override_exclude)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/{{REDACTED}}/site-packages/yamldoc/parser.py", line 129, in parse_yaml
    key, value = line.rstrip().split(":", 1)
    ^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)

python --version
Python 3.11.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions