Class: RuboCop::Cop::Infl::SoftLineLength

Inherits:
RuboCop::Cop show all
Includes:
ConfigurableEnforcedStyle
Defined in:
lib/rubocop/cop/infl/soft_line_length.rb

Overview

Checks forgivingly for line lengths

Constant Summary collapse

HARD_MSG =
'Line exceeds hard length limit. [%d/%d]'.freeze
SOFT_MSG =
'Line exceeds soft length limit. [%d/%d]'.freeze

Instance Method Summary collapse

Instance Method Details

#investigate(processed_source) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/rubocop/cop/infl/soft_line_length.rb', line 11

def investigate(processed_source)
  stats = calculate_stats(processed_source)
  soft_credit =
    (stats.size * soft_allowance_percent_of_lines / 100.0).round

  stats.each do |check, index, length|
    soft_credit = report(soft_credit, check, index, length)
  end
end