vscode-linter
vscode-linter copied to clipboard
yamllint: ignore rule in config file doesn't work
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?
Agreed on your findings, @uwehdaub. Looks like it's better to always spawn the linter process from the current's file directory. Otherwise it breaks the ability of searching linters' config files if parent directories (yamllint in particular).