MarketSquare / robotframework-robocop

Tool for static code analysis of Robot Framework language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] unused-argument when the argument is used in the default of another argument

Lakitna opened this issue · comments

What happened?

Given the following code:

Amazing Keyword
    [Arguments]    ${name}    ${message}=hello ${name}, how are you?
    Log  ${message}

Robocop will consider ${name} to be an unused argument:

//obfuscated/path/to/file.resource:0:0 [W] 0919 Keyword argument '${name}' is not used (unused-argument)

What command/code did you try to run?

robocop //obfuscated/path/to/file.resource

What is the full error message?

//obfuscated/path/to/file.resource:0:0 [W] 0919 Keyword argument '${name}' is not used (unused-argument)

What did you expect to happen instead?

I expect one of two things:

  1. RoboCop should not flag this since ${name} is used in the default value of another argument.
  2. The documentation of the rule should explain why RoboCops behavior is correct.

Operating System

Windows

Robocop version

5.0.0

I have tested it with your code but it does not shown as unused-argument for some reason.. are you using most recent Robocop version?

Ok I see you wrote in bug report that you used 5.0.0. I've just checked and I can reproduce this issue for 5.0.0 but not for 5.0.3 (recent). Please verify on your end

You're correct. I can't reproduce with 5.0.3. I did check the changelog and found nothing related to 0919 🤷‍♂️

I'll close the issue

Yeah, I have also checked - I probably fixed it by foxing something else :) But I have added tests thanks to your issue so it will stay i our regression tests