robotframework-lsp icon indicating copy to clipboard operation
robotframework-lsp copied to clipboard

Allow To Suppress/Disable Warnings/Errors From Visual Studio Code GUI

Open IlfirinPL opened this issue 3 years ago • 6 comments

During code development in some cases you want to ignore rules made by robocop

It would be much more efficient to allow to disable rule directly from "Problems" tab

That would add on end of line # robocop: disable=rule1 image

I would prefer to use names instead of code In example above following example # robocop: disable=empty-section

link related with rule disable https://robocop.readthedocs.io/en/stable/including_rules.html

IlfirinPL avatar Apr 21 '22 18:04 IlfirinPL

Is it even possible to disable a rule globally by any means, so that it is not reported in VS Code? I read the documentation of robocop and robotframework-lsp but I was not able to find it. If not, this feature would be appreciated.

nicolasbillamboz-arrive avatar Feb 10 '23 19:02 nicolasbillamboz-arrive

To disable a Robocop rule globally you can configure it (https://github.com/robocorp/robotframework-lsp/blob/master/robotframework-ls/docs/faq.md#how-to-configure-the-robocop-linter)

For the language server rules you can configure the robot.lint.xxxxx settings.

fabioz avatar Feb 10 '23 19:02 fabioz

No to disable globally. I want to disable for this line only its like adding at end of line ex. # robocop: disable=0509

IlfirinPL avatar Feb 10 '23 19:02 IlfirinPL

@fabioz, thx for pointing out the documentation. It works as expected for my use case.

nicolasbillamboz-arrive avatar Feb 10 '23 20:02 nicolasbillamboz-arrive

No to disable globally. I want to disable for this line only its like adding at end of line ex. # robocop: disable=0509

@IlfirinPL understood, that was just to answer the question from @nicolasbillamboz-flowbird (so, keeping the issue open).

fabioz avatar Feb 11 '23 09:02 fabioz

I found a way to do it as @nicolasbillamboz-flowbird expects it to work although I am not sure if this is best practice..

In the project root, create a pyproject.toml file.

In this file,

`[tool.robocop] paths = [ "tests" ]

exclude = [

"0327",
"0328",
"0501",
"0504",
"0508",
"0505",
"0506",
"0508",
"0920",
"1015"

]

reports = [ "rules_by_id", "scan_timer" ]

format = "[{severity}] | {rule_id} | {desc} | {source}:{line}" output = "robocop.log"`

This excludes certain rules from popping up..

OrrinGradwell avatar Jun 12 '24 15:06 OrrinGradwell