Class: Pedant::CheckEndsWithNewline
- Inherits:
-
Check
- Object
- Check
- Pedant::CheckEndsWithNewline
show all
- Defined in:
- lib/pedant/checks/ends_with_newline.rb
Instance Attribute Summary
Attributes inherited from Check
#result
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Check
all, depends, #fail, #fatal, friendly_name, inherited, #initialize, initialize!, list, #pass, provides, ready?, #report, run_checks_in_dependency_order, #skip, #warn
Constructor Details
This class inherits a constructor from Pedant::Check
Class Method Details
.requires ⇒ Object
29
30
31
|
# File 'lib/pedant/checks/ends_with_newline.rb', line 29
def self.requires
super + [:codes]
end
|
Instance Method Details
#check(file, code) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/pedant/checks/ends_with_newline.rb', line 33
def check(file, code)
return if code[-1] == "\n"
warn
report(:warn, "#{file} does not end with a newline.")
end
|
#run ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/pedant/checks/ends_with_newline.rb', line 41
def run
pass
@kb[:codes].each { |file, code| check(file, code) }
end
|