Sha256: 74c663274e3ceae6ffd8f890ba04fd1107e16e59e24eb739ebda8cd60941a3aa

Contents?: true

Size: 1.08 KB

Versions: 20

Compression:

Stored size: 1.08 KB

Contents

module SlimLint
  # Contains information about a problem or issue with a Slim document.
  class Lint
    # @return [String] file path to which the lint applies
    attr_reader :filename

    # @return [String] line number of the file the lint corresponds to
    attr_reader :line

    # @return [SlimLint::Linter] linter that reported the lint
    attr_reader :linter

    # @return [String] error/warning message to display to user
    attr_reader :message

    # @return [Symbol] whether this lint is a warning or an error
    attr_reader :severity

    # Creates a new lint.
    #
    # @param linter [SlimLint::Linter]
    # @param filename [String]
    # @param line [Fixnum]
    # @param message [String]
    # @param severity [Symbol]
    def initialize(linter, filename, line, message, severity = :warning)
      @linter   = linter
      @filename = filename
      @line     = line || 0
      @message  = message
      @severity = severity
    end

    # Return whether this lint has a severity of error.
    #
    # @return [Boolean]
    def error?
      @severity == :error
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
slim_lint-0.15.1 lib/slim_lint/lint.rb
slim_lint-0.15.0 lib/slim_lint/lint.rb
slim_lint-0.14.0 lib/slim_lint/lint.rb
slim_lint-0.13.0 lib/slim_lint/lint.rb
slim_lint-0.12.0 lib/slim_lint/lint.rb
slim_lint-0.11.0 lib/slim_lint/lint.rb
slim_lint-0.10.0 lib/slim_lint/lint.rb
slim_lint-0.9.0 lib/slim_lint/lint.rb
slim_lint-0.8.3 lib/slim_lint/lint.rb
slim_lint-0.8.2 lib/slim_lint/lint.rb
slim_lint-0.8.1 lib/slim_lint/lint.rb
slim_lint-0.8.0 lib/slim_lint/lint.rb
slim_lint-0.7.2 lib/slim_lint/lint.rb
slim_lint-0.7.1 lib/slim_lint/lint.rb
slim_lint-0.7.0 lib/slim_lint/lint.rb
slim_lint-0.6.1 lib/slim_lint/lint.rb
slim_lint-0.6.0 lib/slim_lint/lint.rb
slim_lint-0.5.0 lib/slim_lint/lint.rb
slim_lint-0.4.0 lib/slim_lint/lint.rb
slim_lint-0.3.0 lib/slim_lint/lint.rb