Skip to content

yamllint: ignore rule in config file doesn't work #39

@uwehdaub

Description

@uwehdaub

I've created some ignore rule in .yamllint.yaml like the following

rules:
  indentation:
    ignore:
      - "base/templates/deployment.yaml"

When I run yamllint from the command line all works fine.
But in VS-Code I still get a line to long error.

After some experimentation I stumbled about this in .settings

    "yamllint": {
      "capabilities": ["ignore-line"],
      "command": [
        "yamllint",
        "--format",
        "parsable",
        ["$config", "--config-file", "$config"],
        "-"
      ],
...

which means, yamllint reads the file from stdin and obvious has no filename.

I can get around this problem by calling yamllint with the filename

    "yamllint": {
      "capabilities": ["ignore-line"],
      "command": [
        "yamllint",
        "--format",
        "parsable",
        ["$config", "--config-file", "$config"],
        "$file" # <-- change!
      ],
...

but I have to re-write the ignore rules to

rules:
  indentation:
    ignore:
      - "**/base/templates/deployment.yaml"

because it seems, that yamllint is not executed from the root of the workspace.

After these changes my yaml files are linted as they were linted from the command line.

Is there anything that I miss, or is there a better way to tackle this problem?

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