Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False-positive UnusedArgument warning #61

Open
printercu opened this issue Aug 10, 2017 · 4 comments
Open

False-positive UnusedArgument warning #61

printercu opened this issue Aug 10, 2017 · 4 comments
Labels

Comments

@printercu
Copy link
Contributor

Hi!

I've found that block argument which is used as attribute value generates warning, like this:

- 2.times do |x|
  div attr=x

Can this be fixed?

@printercu
Copy link
Contributor Author

Have also faced a warning with:

- if a.size == 2
  .first= a.first
  .last= a.last
- else
  = a.last

/ test.slim:3 [W] RuboCop: Move `a.last` out of the conditional.
/ test.slim:5 [W] RuboCop: Move `a.last` out of the conditional.

@printercu
Copy link
Contributor Author

One more similar to first one:

= capture
  - style = :test
  div class=style

- capture
  - other_style = :test
  div class=other_style

/ gives warning only for the first part:
/ test.slim:2 [W] RuboCop: Useless assignment to variable - `style`.

@sds
Copy link
Owner

sds commented Sep 6, 2017

Thanks for the reports, @printercu.

I can't reproduce the issue for the first example you give:

- 2.times do |x|
  div attr=x

This doesn't output a warning for me.

I can reproduce the issue for your other examples, however.

Can I get you to confirm that you see an issue for this first case? If so, can you include the output of slim-lint -V?

@printercu
Copy link
Contributor Author

I can't reproduce exactly the same case too :) I don't remember, maybe I've checked this only within template and it was wrapped into other block. So it's close to 3d case, but maybe slightly different:

= capture
  - 2.times do |x|
    div attr=x

@sds sds added the bug label Sep 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants