slim-lint icon indicating copy to clipboard operation
slim-lint copied to clipboard

False-positive UselessAssignment when in a slim capture block

Open jhubert opened this issue 7 years ago • 4 comments

This is a simple recreation of the issue I bumped into with a form_for helper in rails. I'm using capture so that it's distilled down to the essence of the issue:

- url = 'https://google.com'
= capture do
  a href=url = 'Google'

Running slim-lint on this gives me:

test.html.slim:2 [W] RuboCop: Useless assignment to variable - `url`.

jhubert avatar Oct 01 '17 04:10 jhubert

up

seliverstov-maxim avatar May 07 '19 20:05 seliverstov-maxim

I believe this happens with any method that takes a block, not just capture.

yjukaku avatar Aug 05 '21 19:08 yjukaku

Any idea on how to fix this. Happy to open a PR with some guidance.

jclusso avatar Feb 26 '24 18:02 jclusso