Sha256: 910682d46cec754abdd1a091ff9e2e5a4f53c43ce56e3145d96fe26e79541d0d

Contents?: true

Size: 565 Bytes

Versions: 23

Compression:

Stored size: 565 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

23 entries across 23 versions & 3 rubygems

Version Path
scss-lint-0.25.0 lib/scss_lint/linter/final_newline.rb
scss-lint-0.24.1 lib/scss_lint/linter/final_newline.rb
scss-lint-0.24.0 lib/scss_lint/linter/final_newline.rb