Class: Yamlint::Rules::NewLines

Inherits:
Base
  • Object
show all
Defined in:
lib/yamlint/rules/new_lines.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #level

Instance Method Summary collapse

Methods inherited from Base

defaults, desc, inherited, #initialize, rule_id

Constructor Details

This class inherits a constructor from Yamlint::Rules::Base

Instance Method Details

#check(context) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/yamlint/rules/new_lines.rb', line 10

def check(context)
  return [] if context.empty?

  expected_type = @config[:type]
  problems = []

  context.lines.each_with_index do |line, index|
    line_number = index + 1
    problem = check_line_ending(line, line_number, expected_type)
    problems << problem if problem
  end

  problems
end

#fixable?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/yamlint/rules/new_lines.rb', line 25

def fixable?
  true
end