Skip to content
#

rubocop

Here are 213 public repositories matching this topic...

dmytro-savochkin
dmytro-savochkin commented Aug 9, 2020

I think Style/IfUnlessModifier doesn't correctly handle the case when there is a first-line comment (right after the if keyword) AND some code right after the end keyword. If you correct this code with rubocop -a it would put the comment right after the end keyword, before the code that was there previously. This basically makes the code invalid after correction.

This probably can be

lsimoneau
lsimoneau commented Mar 22, 2017

I really like enforcing one expectation per example. But with RSpec's exception matching, you need two expect calls if you want to assert something about an exception:

expect { my_code }.to raise_error(MyErrorType) do |error|
  expect(error.message).to match /something went wrong/
end

There's no way to match against the error message without first wrapping the call, and RSpec o

rasaffie
rasaffie commented Aug 27, 2020

Expected behavior

Don't auto-correct inject on unsafe cases of Style/EachWithObject + Rails/IndexWith.

Actual behavior

It replaces inject with index_with, but with an undefined variable.

Steps to reproduce the problem

  • With code:
def self.make_hash(names)
  names.inject({}) { |result, name| result[name] = Date::MONTHNAMES[result.count + 1]; result }
e

Improve this page

Add a description, image, and links to the rubocop topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the rubocop topic, visit your repo's landing page and select "manage topics."

Learn more

You can’t perform that action at this time.