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

Rule severity depending on thresholds

Open adrszad opened this issue 2 years ago • 3 comments

I'd like to configure e. g. line-too-long to raise warning if length>140, but error when length>200. The same for other parameterized rules.

adrszad avatar May 31 '22 13:05 adrszad

Nice idea! I need to take a look if it's a low-hanging fruit or it requires significant changes to the code.

mnojek avatar Jun 01 '22 08:06 mnojek

I have an idea how it could be implemented - I will try it.

The basic design for now: introduce new class SeverityThreshold which can be added to Rule definition. It should contain name of the RuleParam that 'controls' severity of the rule: image

It could be then configured the same way return status is configured:

robocop -c line-too-long:severity_threshold:warning=140:error=200

By default it would support int but if there is need we could add support for other types (like boolean).

bhirsz avatar Jul 29 '22 07:07 bhirsz

I've manage to implement this. I'm currently working on updating our engine for generating the docs and tests. Docs example:

image

bhirsz avatar Jul 29 '22 09:07 bhirsz