Class: Yamlint::Rules::EmptyValues
- Defined in:
- lib/yamlint/rules/empty_values.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from LineRule
Methods inherited from Base
#check, defaults, desc, #fixable?, 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 34 35 36 37 38 |
# File 'lib/yamlint/rules/empty_values.rb', line 13 def check_line(line, line_number, _context) return if line.strip.empty? return if line.strip.start_with?('#') problems = [] if @config[:'forbid-in-block-mappings'] && line.match?(/:\s*$/) && !line.match?(/[|>]/) problems << problem( line: line_number, column: line.index(':') + 1, message: 'empty value in block mapping', fixable: false ) end if @config[:'forbid-in-flow-mappings'] && line.match?(/:\s*[,}]/) problems << problem( line: line_number, column: line.index(':') + 1, message: 'empty value in flow mapping', fixable: false ) end problems end |