Sha256: eeae22bbb433b8bc39498b418bb35f8f80be48d46cfd85306d63d7fb00386eab

Contents?: true

Size: 564 Bytes

Versions: 3

Compression:

Stored size: 564 Bytes

Contents

module SCSSLint
  # Checks for final newlines at the end of a file.
  class Linter::FinalNewline < Linter
    include LinterRegistry

    def visit_root(node)
      return if engine.lines.empty?

      ends_with_newline = engine.lines[-1][-1] == "\n"

      if config['present']
        add_lint(engine.lines.count,
                 'Files should end with a trailing newline') unless ends_with_newline
      else
        add_lint(engine.lines.count,
                 'Files should not end with a trailing newline') if ends_with_newline
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
scss-lint-0.23.1 lib/scss_lint/linter/final_newline.rb
scss-lint-0.23.0 lib/scss_lint/linter/final_newline.rb
scss-lint-0.22.0 lib/scss_lint/linter/final_newline.rb