Method: ERBLint::Linters::BaseLinter#autocorrect

Defined in:
lib/primer/view_components/linters/base_linter.rb

#autocorrect(processed_source, offense) ⇒ Object

[View source]

85
86
87
88
89
90
91
92
93
94
95
# File 'lib/primer/view_components/linters/base_linter.rb', line 85

def autocorrect(processed_source, offense)
  return unless offense.context

  lambda do |corrector|
    if offense.context.include?(counter_disable)
      correct_counter(corrector, processed_source, offense)
    else
      corrector.replace(offense.source_range, offense.context)
    end
  end
end