Class: HamlLint::Linter::FinalNewline
- Inherits:
-
Linter
- Object
- Linter
- HamlLint::Linter::FinalNewline
- Includes:
- HamlLint::LinterRegistry
- Defined in:
- lib/haml_lint/linter/final_newline.rb
Overview
Checks for final newlines at the end of a file.
Instance Method Summary collapse
Methods included from HamlLint::LinterRegistry
extract_linters_from, included
Instance Method Details
#visit_root(root) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/haml_lint/linter/final_newline.rb', line 14 def visit_root(root) return if document.source.empty? line_number = document.last_non_empty_line node = root.node_for_line(line_number) return if node.disabled?(self) present = config['present'] ? true : false corrected = corrected_source(present) return if document.source == corrected record_lint(line_number, (present), corrected: autocorrect?) apply_autocorrect(corrected) end |