Skip to content

Default codeclimate-rubocop engine does not support Ruby 2.6+

The defaults for .codeclimate.yml enable the rubocop engine but specify the stable channel by not specifying any override.

In the codeclimate-rubocop repo the stable channel uses a very old Rubocop version of 0.52.1, which did not support any of the recent Ruby releases such as 2.6, 2.7, etc.:

/usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config.rb:510:in `check_target_ruby': Unknown Ruby version 2.7 found in `.ruby-version`. (RuboCop::ValidationError)
111Supported versions: 2.1, 2.2, 2.3, 2.4, 2.5
112	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config.rb:313:in `validate'
113	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config.rb:201:in `check'
114	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config.rb:194:in `create'
115	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config_loader.rb:48:in `load_file'
116	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config_loader.rb:79:in `configuration_from_file'
117	from /usr/local/bundle/gems/rubocop-0.52.1/lib/rubocop/config_store.rb:44:in `for'
118	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:38:in `rubocop_file_to_include?'
119	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:16:in `block in expanded_list'
120	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `each'
121	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `flat_map'
122	from /usr/src/app/lib/cc/engine/file_list_resolver.rb:13:in `expanded_list'
123	from /usr/src/app/lib/cc/engine/rubocop.rb:49:in `files_to_inspect'
124	from /usr/src/app/lib/cc/engine/rubocop.rb:29:in `block in run'
125	from /usr/src/app/lib/cc/engine/rubocop.rb:28:in `chdir'
126	from /usr/src/app/lib/cc/engine/rubocop.rb:28:in `run'
127	from /usr/src/app/bin/codeclimate-rubocop:17:in `<main>'
128Could not analyze code quality for the repository at /code

Users looking to run the code quality checks over recent Ruby version projects encounter a failure out of the box, unless they also override the version through .codeclimate.yml file as:

plugins:
  rubocop:
    enabled: true
    channel: rubocop-0-67 # or higher for 2.7, 3.0, etc.

Can we alter our defaults to support recent versions of Ruby in Rubocop, through specifying a more recent channel of codeclimate-rubocop?

One caveat of bumping the Rubocop version is that Rubocop has also removed support for older Ruby versions over time, so very old versions of Ruby in use such as 2.1, 2.2, or 2.3 could stop working depending on the version chosen.

Note: This was reported over support by a premium customer (internal link)

Edited by Harsh Chouraria