vscode-yaml icon indicating copy to clipboard operation
vscode-yaml copied to clipboard

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

Open alex-novikov-1990 opened this issue 2 years ago • 30 comments

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

alex-novikov-1990 avatar Dec 22 '21 09:12 alex-novikov-1990

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).

franzbischoff avatar Feb 03 '22 22:02 franzbischoff

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

zvalcav avatar Apr 15 '22 10:04 zvalcav

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

    "yaml.customTags": [

        "!reference sequence"
    ],
    ```

jwthomp avatar May 18 '22 17:05 jwthomp

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

zvalcav avatar May 18 '22 19:05 zvalcav

Any updates on this?

govindrai avatar Jun 14 '22 22:06 govindrai

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?

CMCDragonkai avatar Jul 02 '22 10:07 CMCDragonkai

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 }

huksley avatar Jul 15 '22 11:07 huksley

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

lmburns avatar Jan 03 '23 22:01 lmburns

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

prescod avatar Jan 19 '23 17:01 prescod

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

mmbarness avatar Feb 01 '23 15:02 mmbarness

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.

iamWing avatar Feb 16 '23 11:02 iamWing

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

MattGurney avatar Mar 13 '23 03:03 MattGurney

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

quantfreedom avatar Apr 01 '23 02:04 quantfreedom

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!

this-fifo avatar May 23 '23 13:05 this-fifo

image

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

gremo avatar Jun 13 '23 19:06 gremo

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?

xKelvin avatar Oct 18 '23 01:10 xKelvin

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

%{ if node_type_index != "server-0" }
server: https://<snip>
%{ endif }

sarg3nt avatar Nov 15 '23 21:11 sarg3nt

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

smp4 avatar Nov 20 '23 05:11 smp4

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

We really need an "ignore" list for YAML!

QAnders avatar Nov 24 '23 07:11 QAnders

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

gjrtimmer avatar Dec 01 '23 06:12 gjrtimmer

Bump +1 for this

pvbhanuteja avatar Dec 21 '23 11:12 pvbhanuteja

+1 Bump this was originally requested 2+ years ago

Hadlock avatar Feb 25 '24 01:02 Hadlock

+1

MarwanAlsoltany avatar Feb 27 '24 12:02 MarwanAlsoltany

Any update on this? Can you keep us updated?

Aleqsd avatar Feb 27 '24 18:02 Aleqsd

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

michelefa1988 avatar Feb 29 '24 12:02 michelefa1988

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 = {...

rickalex21 avatar Mar 23 '24 22:03 rickalex21

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

ArjixWasTaken avatar May 07 '24 00:05 ArjixWasTaken

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.

msivasubramaniaan avatar May 07 '24 06:05 msivasubramaniaan

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?

ArjixWasTaken avatar May 07 '24 12:05 ArjixWasTaken