Class: Yamlint::Rules::OctalValues

Inherits:
LineRule show all
Defined in:
lib/yamlint/rules/octal_values.rb

Constant Summary collapse

IMPLICIT_OCTAL_PATTERN =
/:\s*0[0-7]+\s*(?:#.*)?$/
EXPLICIT_OCTAL_PATTERN =
/:\s*0o[0-7]+\s*(?:#.*)?$/i
IMPLICIT_VALUE_PATTERN =
/:\s*(0[0-7]+)/
EXPLICIT_VALUE_PATTERN =
/:\s*(0o[0-7]+)/i

Instance Attribute Summary

Attributes inherited from Base

#config, #level

Instance Method Summary collapse

Methods inherited from LineRule

#check

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



19
20
21
22
23
24
25
26
27
# File 'lib/yamlint/rules/octal_values.rb', line 19

def check_line(line, line_number, _context)
  return if line.strip.empty?
  return if line.strip.start_with?('#')

  problems = []
  check_implicit_octal(line, line_number, problems)
  check_explicit_octal(line, line_number, problems)
  problems
end