prontolabs / pronto-rubocop

Pronto runner for Rubocop, ruby code analyzer
MIT License
80 stars 74 forks source link

Enable suggestions when a line has multiple offenses #70

Closed letmein closed 2 years ago

letmein commented 2 years ago

Hi!

I found that suggestions are not being added when a line has more than one offense.

For example, we need to enforce double quotes:

  ['a', 'b']

This line will be counted twice here: https://github.com/prontolabs/pronto-rubocop/blob/67d9cbf22acfa0ab7616339c66eed02f3ae0832d/lib/pronto/rubocop/offense_line.rb#L69

And it will give a false positive in the following guard condition: https://github.com/prontolabs/pronto-rubocop/blob/67d9cbf22acfa0ab7616339c66eed02f3ae0832d/lib/pronto/rubocop/offense_line.rb#L37

I changed it to count only unique line numbers that contain offences, so the count of corrections matches differing_lines_count.

ashkulz commented 2 years ago

@letmein can you change this line to 2.5 so that the tests will pass?

letmein commented 2 years ago

@ashkulz done

ashkulz commented 2 years ago

Thanks for the contribution, @letmein!

ashkulz commented 2 years ago

This has been pushed to RubyGems as 0.11.2 :tada: