Skip to content

Update rubocop target ruby version

Nick Thomas requested to merge (removed):update-rubocop into master

What does this MR do?

Updates our rubocop version to target v2.5 rather than 2.3 (presumably the default?)

2.5 introduces new syntax around ensure that is already creeping into our codebase. Rubocop should accept it. Example failure: https://gitlab.com/nick.thomas/gitlab-ce/-/jobs/153747894 .

The old syntax looks like, e.g.:

around do
  begin
  ensure
  end
end

foo.each do |x|
  begin
  rescue
  end
end

The new syntax looks like, e.g.:

around do
ensure
end

foo.each do |x|
rescue
end

Other changes include:

  • Mandating the unpack1(...) method instead of using unpack(...)[0]
  • Mandating .match? instead of =~. I disabled this one as it's not always safe to do this.

All corrections were automatically generated through bundle exec rubocop -a. We shouldn't merge this unless it's quite close to HEAD as otherwise, we risk making master red.

Does this MR meet the acceptance criteria?

Edited by Nick Thomas

Merge request reports