Class: Yamlint::Rules::Hyphens
- Defined in:
- lib/yamlint/rules/hyphens.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from LineRule
Methods inherited from Base
#check, defaults, desc, inherited, #initialize, rule_id
Constructor Details
This class inherits a constructor from Yamlint::Rules::Base
Instance Method Details
#check_line(line, line_number, _context) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/yamlint/rules/hyphens.rb', line 13 def check_line(line, line_number, _context) return if line.strip.empty? return if line.strip.start_with?('#') problems = [] max_after = @config[:'max-spaces-after'] line.scan(/^(\s*)-(\s+)/) do |_indent, spaces| next if spaces.length <= max_after pos = $LAST_MATCH_INFO.begin(2) problems << problem( line: line_number, column: pos + 1, message: "too many spaces after hyphen (#{spaces.length} > #{max_after})", fixable: true ) end problems end |
#fixable? ⇒ Boolean
35 36 37 |
# File 'lib/yamlint/rules/hyphens.rb', line 35 def fixable? true end |