redhat-developer / vscode-yaml

YAML support for VS Code with built-in kubernetes syntax support
MIT License
648 stars 219 forks source link

There is no ability to disable linting for a certain line/subtree. #666

Open alex-novikov-1990 opened 2 years ago

alex-novikov-1990 commented 2 years ago

Is your enhancement related to a problem? Please describe.

The schema definition is out of my control and has a flaw: one property is defined as string, but accepts arbitrary objects. This leads to false errors.

Describe the solution you would like

I would like to be able to disable linting for some properties via comments in the code. Something like # yaml-schema disable-next-line.

Describe alternatives you have considered

I considered disabling linting completely for the whole file or for the schema. But these alternatives are not precise enough.

Additional context

franzbischoff commented 2 years ago

Every linter has some # nolint statement, I couldnt even find such a thing on eemeli/yaml ...

It is unproductive to have many "false alarms" in your environment when you know the code is correct but there is some limitation on the linter (or schema, etc).

zvalcav commented 2 years ago

I've similar problem. Since I started using gitlab-ci.yml !reference feature, I have critical error in my code. Only solution, mentioned in many places, is to disable RedHat YAML extension. Hope you can add some # ignore this line etc. soon. Your extension gives a lot of useful tips and checks syntax very well. This is the only problem I had with it so far.

image

jwthomp commented 2 years ago

@zvalcav To fix that issue, add to vocodes settings:

    "yaml.customTags": [

        "!reference sequence"
    ],
zvalcav commented 2 years ago

@jwthomp it worked. Thank you very much :-)

govindrai commented 2 years ago

Any updates on this?

CMCDragonkai commented 2 years ago

I'm using a url on the gitlab environment and the schema says only http or https are allowed. I'd like to use my custom url protocol pk://. Anyway to disable this check or just for this one line?

huksley commented 2 years ago

Is there any way to not put settings into .vscode but directly reference in the .yml file? I have multiple files with different custom tags and it will be difficult to put them all into VSCode configuration.

# ...Excerpt from serverless.yml...
    layers:
      # yaml-schema-disable-next-line incorrect-type
      - { Ref: FontsLambdaLayer }
lmburns commented 1 year ago

@huksley I like your idea a lot. Would be nice to have this. Any update now?

prescod commented 1 year ago

I also need this feature due to an upstream with an incorrectly strict schema.

mmbarness commented 1 year ago

I'd also like this a lot, for the same reasons as everyone else

iamWing commented 1 year ago

I often write Azure DevOps pipeline templates and since there're quite a few non-standard yaml syntax that DevOps uses, I got red lines complaining about incorrect syntax or something not match the pattern on pretty much all the template files due to how the upstream Azure pipeline schema is designed for writing the pipeline in one single azure-pipeline.yml file. Wish there is a feature for me to disable errors on certain lines in within the file.

MattGurney commented 1 year ago

This feature would be good, I have this problem with CircleCI config file config.yml.

quantfreedom commented 1 year ago

I really don't understand how this isn't a thing already ... there is no way the people who use this product aren't running into the same issue as all of us ... how could they just keep on going in life knowing this is a problem ... it is beyond annoying and should be such a simple fix

this-fifo commented 1 year ago

I'm running into this issue, does anyone know of a workaround to disable for this type of scenario?

Context I am using Serverless Framework and when I use its variables in a CloudFormation section yaml-schema complains (note: both the variable transformation and the deployment works as expected)

image

Is there a way I can at least override that in vscode similar to the yaml.customTags mentioned in https://github.com/redhat-developer/vscode-yaml/issues/666#issuecomment-1130290691 above?

Thanks!

gremo commented 1 year ago

image

Ad a lot of others, since my compose file is using ENV vars...

xKelvin commented 11 months ago

I'm facing the same issue. @msivasubramaniaan @gorkem Excuse the ping, but is anyone on the team able to chime in on this, and the duplicate issues?

sarg3nt commented 10 months ago

Facing the same issue when templating a yaml file with terraform. I.e.

%{ if node_type_index != "server-0" }
server: https://<snip>
%{ endif }
smp4 commented 10 months ago

Same issue here. In my (recurring) instance, for Kustomize strategicpatchmerge files as already described in #915

QAnders commented 10 months ago

Serverless YAML also commonly uses functions, it too has that annoying lint error: image

We really need an "ignore" list for YAML!

gjrtimmer commented 9 months ago

Is there any update on this issue, I would like the ability to disable a line with a comment

pvbhanuteja commented 9 months ago

Bump +1 for this

Hadlock commented 6 months ago

+1 Bump this was originally requested 2+ years ago

MarwanAlsoltany commented 6 months ago

+1

Aleqsd commented 6 months ago

Any update on this? Can you keep us updated?

michelefa1988 commented 6 months ago

Same here. I have many like this which I want to ignore image

rickalex21 commented 6 months ago

Is there a way to disable in neovim Incorrect type with a comment? In lua this is easy to do with:

---@diagnostic disable-next-line: missing-fields
formatting = {...
ArjixWasTaken commented 4 months ago

2 years and 5 months, and this is still unresolved?

msivasubramaniaan commented 4 months ago

Hello @ArjixWasTaken

We don't have enough developer to look at this at the moment. We will try to address it at the earliest. Mean time we are happy to receive contributions as well.

ArjixWasTaken commented 4 months ago

Hello @ArjixWasTaken

We don't have enough developer to look at this at the moment. We will try to address it at the earliest. Mean time we are happy to receive contributions as well.

So it is not a matter of you refusing such a feature, but a lack of manpower?

shakefu commented 2 months ago

Throwing a vote for # noqa to ignore errors on a specific line.

rao-komar-port commented 2 months ago

Please add this!