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

Detect unused arguments

Open MoreFamed opened this issue 4 years ago • 3 comments

I suggest creating a new rule which would report an argument of a keyword if it is not used at all in the body of keyword (be it declared in [Arguments], or in the keyword name in case of embedded arguments). E. g.:

My Keyword
    [Arguments}  ${arg}  # <-- unused!
    Log  Hello!

Note: No dynamic analysis...

Note 2: I do not suggest this new rule to check when an argument is used, but a value is assigned to it only without retieving it again --- this situation should be covered by https://github.com/MarketSquare/robotframework-robocop/issues/209 once it will be implemented. :)

MoreFamed avatar Sep 17 '21 10:09 MoreFamed

That can be done. Thanks! And you are welcome to come up with your solution by creating a PR to this project, if you have some time :)

mnojek avatar Sep 17 '21 10:09 mnojek

@mnojek, this is not a matter of time. My knowledge of Python and object-oriented programming do not allow me to contribute to such a big project...

MoreFamed avatar Sep 17 '21 11:09 MoreFamed

No problem. Contributing by giving ideas is also extremely helpful. Thanks to that, we can further improve the tool :)

mnojek avatar Sep 17 '21 12:09 mnojek