Class: RuboCop::Cop::Legacy::Corrector
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
::RuboCop::Cop::Corrector ,
Parser::Source::TreeRewriter
|
|
Instance Chain:
self,
::RuboCop::Cop::Corrector ,
Parser::Source::TreeRewriter
|
|
Inherits: |
RuboCop::Cop::Corrector
|
Defined in: | lib/rubocop/cop/legacy/corrector.rb |
Overview
Legacy Corrector for v0 API support. See https://docs.rubocop.org/rubocop/v1_upgrade_notes.html
Constant Summary
::RuboCop::Cop::Corrector
- Inherited
Class Method Summary
-
.new(source, corr = []) ⇒ Corrector
constructor
Support legacy second argument.
::RuboCop::Cop::Corrector
- Inherited
.new | corrector = Corrector.new(cop). |
.source_buffer | Duck typing for get to a ::Parser::Source::Buffer. |
Instance Method Summary
::RuboCop::Cop::Corrector
- Inherited
#remove_leading | Removes |
#remove_preceding | Removes |
#remove_trailing | Removes |
#rewrite | Legacy. |
#swap | Swaps sources at the given ranges. |
#check_range_validity, #to_range, #validate_buffer |
Constructor Details
.new(source, corr = []) ⇒ Corrector
Support legacy second argument
# File 'lib/rubocop/cop/legacy/corrector.rb', line 10
def initialize(source, corr = []) super(source) if corr.is_a?(CorrectionsProxy) merge!(corr.send(:corrector)) else unless corr.empty? warn Rainbow(<<~WARNING).yellow, uplevel: 1 `Corrector.new` with corrections is deprecated. See https://docs.rubocop.org/rubocop/v1_upgrade_notes.html WARNING end corr.each { |c| corrections << c } end end
Instance Method Details
#corrections
[ GitHub ]# File 'lib/rubocop/cop/legacy/corrector.rb', line 26
def corrections warn Rainbow(<<~WARNING).yellow, uplevel: 1 `Corrector#corrections` is deprecated. Open an issue if you have a valid usecase. See https://docs.rubocop.org/rubocop/v1_upgrade_notes.html WARNING CorrectionsProxy.new(self) end