codeclimate-rubocop icon indicating copy to clipboard operation
codeclimate-rubocop copied to clipboard

Confusing `Style/HashSyntax` warnings in CC, nothing in local.

Open nomoon opened this issue 8 years ago • 3 comments

In the following snippet of code, the action method call is resulting in 5 separate Style/HashSyntax warnings from the rubocop engine while my local rubocop check gives me none:

def monitor_check_add(name:, type:, fail_count:, success_count:, check_interval:,
                      **from_check_type)
  action(:monitor, :"check-add", name: name, type: type, fail_count: fail_count,
    success_count: success_count, check_interval: check_interval, **from_check_type)
end

Since there are 5 warnings, I'm guessing those are the 5 required keyword arguments in the call. I have many lines of code like this that are not causing any warnings, although this is the only line with a hash-splat parameter (**from_check_type) in the call.

nomoon avatar Feb 10 '17 09:02 nomoon

Hm interesting. Thanks for opening the issue.

Which version of rubocop are you running? We're (currently) running 0.46 in the engine.

maxjacobson avatar Feb 13 '17 16:02 maxjacobson

Aha! Does seem to be a problem with Rubocop 0.46. I'm running 0.47.1 without the error, but when I manually dropped down to 0.46 it appeared locally.

nomoon avatar Feb 15 '17 04:02 nomoon

Looks like it's bbatsov/rubocop#3898 (see also https://github.com/twe4ked/rubocop-mixed-hash-test) which appears to be fixed by 0.47.

nomoon avatar Feb 15 '17 04:02 nomoon