Rubocop: Gemspec/RequiredRubyVersion too strict

Created on 14 Dec 2017  路  4Comments  路  Source: rubocop-hq/rubocop

My gem targets Ruby 2.0+.

Rubocop has a minimal TargetRubyVersion of 2.1

The cop Gemspec/RequiredRubyVersion is complaining, although I don't feel I am not doing anything wrong here.

Probably best not to complain in those cases.

$ rubocop -v
0.52.0

All 4 comments

RuboCop does not support your gem. So you should downgrade RuboCop to support Ruby 2.0. You can use RuboCop 0.50.0.
I think using RuboCop with unsupported Ruby version is crazy.

You might not have the best experience, because TargetRubyVersion: 2.1 will make suggestions that might not apply to Ruby 2.0. The quick fix is to simply disable Gemspec/RequiredRubyVersion.

Although personally I think supporting Ruby versions which are no longer supported by the core team is not very nice. By doing so we're enabling people to not upgrade (which in Ruby is usually a trivial task) from insecure rubies. (This is the reason we don't support 2.0. 馃檪) Of course this is up for each individual maintainer to decide for themselves.

Understood @Drenmi , thanks.

@pocke: I feel your comment is offensive.

Sorry, my English is not good enough.

I think we have three choices to avoid your problem.

  • Downgrade RuboCop's version

    • I recommend.

  • Drop Ruby 2.0 support from your gem

    • Also I recommend.

  • Disable Gemspec/RequiredRubyVersion cop

    • I don't recommend this much. Because other cops don't support Ruby 2.0 also, so maybe other cops also breaks in your gem.

And I think we should not relax the cop, because it is correct warnings. TargetRubyVersion and required_ruby_version are not match in the case. The versions should be match for correct analysis.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

david942j picture david942j  路  3Comments

printercu picture printercu  路  3Comments

mikegee picture mikegee  路  3Comments

AndreiMotinga picture AndreiMotinga  路  3Comments

deivid-rodriguez picture deivid-rodriguez  路  3Comments