Class: Yamlint::Rules::Comments

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

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, 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



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/yamlint/rules/comments.rb', line 15

def check_line(line, line_number, _context)
  return unless line.include?('#')

  problems = []

  return problems if @config[:'ignore-shebangs'] && line_number == 1 && line.start_with?('#!')

  problems.concat(check_starting_space(line, line_number))
  problems.concat(check_spaces_from_content(line, line_number))
  problems
end

#fixable?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/yamlint/rules/comments.rb', line 27

def fixable?
  true
end