Skip to content

Header seperator not handledΒ #298

@spreiter

Description

@spreiter

Description

The YAML header is not recognized properly and messes up the output.

Steps to reproduce

Example from gitlab CI/CD inputs: https://docs.gitlab.com/ci/inputs/examples/#use-cicd-inputs-in-variable-expressions

spec:
  inputs:
    linter:
    lint-path:
---
"run-$[[ inputs.linter ]]-lint":
  script: ./lint --$[[ inputs.linter ]] --path=$[[ inputs.lint-path ]]

Current behavior

  • With YAMLFIX_EXPLICIT_START=true and additional --- is added at the top.
  • With YAMLFIX_EXPLICIT_START=false the --- between the header and the rest is removed.

Desired behavior

If a --- is somewhere in the file (still comments at the top could be allowed, I guess), do not handle it.

However I am not sure, whether the "usual" header style or whatever Gitlab is using allows an additional --- at the top.

Environment

$ uvx --with yamlfix python -c "import yamlfix.version; print(yamlfix.version.version_info())" 
------------------------------------------------------------------
     yamlfix: 1.17.0
     Python: 3.12.8
     Platform: macOS-15.5-arm64-arm-64bit
------------------------------------------------------------------

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions