Class: RemLint::Rules::LineLength
- Inherits:
-
RemLint::Rule
- Object
- RemLint::Rule
- RemLint::Rules::LineLength
- Defined in:
- lib/remlint/rules/line_length.rb
Overview
Physical lines past a configured width.
Off by default, and measured on physical lines rather than joined ones, because the whole point of a backslash continuation is to keep a long command inside the margin -- reporting the joined length would report the very files that did the right thing.
Remind has its own limit, $MaxLineLength, but that is a runtime guard
against a runaway INCLUDECMD, not a style setting; this is the style
setting.
Constant Summary collapse
- DEFAULT_MAXIMUM =
100
Constants inherited from RemLint::Rule
Instance Attribute Summary
Attributes inherited from RemLint::Rule
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from RemLint::Rule
all, find, inherited, #initialize, rule_name, #rule_name, #run
Constructor Details
This class inherits a constructor from RemLint::Rule
Class Method Details
.default_severity ⇒ Object
24 25 26 |
# File 'lib/remlint/rules/line_length.rb', line 24 def self.default_severity "info" end |
.description ⇒ Object
28 29 30 |
# File 'lib/remlint/rules/line_length.rb', line 28 def self.description "Physical lines longer than Max characters." end |
.enabled_by_default? ⇒ Boolean
20 21 22 |
# File 'lib/remlint/rules/line_length.rb', line 20 def self.enabled_by_default? false end |
Instance Method Details
#check ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/remlint/rules/line_length.rb', line 32 def check maximum = option("Max", DEFAULT_MAXIMUM) document.each_raw_line do |raw, line| length = raw.chomp.length if length > maximum offend(line, "Line is #{length} characters, over the #{maximum} allowed", column: maximum + 1) end end end |