Module: RuboCop::AST::RuboCopCompatibility Private

Included in:
RuboCop::AST
Defined in:
lib/rubocop/ast/rubocop_compatibility.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Responsible for compatibility with main gem

Constant Summary collapse

INCOMPATIBLE_COPS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  '0.89.0' => 'Layout/LineLength',
  '0.92.0' => 'Style/MixinUsage'
}.freeze

Instance Method Summary collapse

Instance Method Details

#rubocop_loadedObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rubocop/ast/rubocop_compatibility.rb', line 13

def rubocop_loaded
  loaded = Gem::Version.new(RuboCop::Version::STRING)
  incompatible = INCOMPATIBLE_COPS.select do |k, _v|
    loaded < Gem::Version.new(k)
  end.values
  return if incompatible.empty?

  warn <<~WARNING
    *** WARNING – Incompatible versions of `rubocop` and `rubocop-ast`
    You may encounter issues with the following \
    Cop#{'s' if incompatible.size > 1}: #{incompatible.join(', ')}
    Please upgrade rubocop to at least v#{INCOMPATIBLE_COPS.keys.last}
  WARNING
end