Sha256: 568942aae19e902eb3b304ade48214c72bc9082b6f8344c37daa21b6548ed5c2

Contents?: true

Size: 1.11 KB

Versions: 23

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

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

23 entries across 23 versions & 1 rubygems

Version Path
slim_lint-0.31.1 lib/slim_lint/lint.rb
slim_lint-0.31.0 lib/slim_lint/lint.rb
slim_lint-0.30.0 lib/slim_lint/lint.rb
slim_lint-0.29.0 lib/slim_lint/lint.rb
slim_lint-0.28.0 lib/slim_lint/lint.rb
slim_lint-0.27.0 lib/slim_lint/lint.rb
slim_lint-0.26.0 lib/slim_lint/lint.rb
slim_lint-0.25.0 lib/slim_lint/lint.rb
slim_lint-0.24.0 lib/slim_lint/lint.rb
slim_lint-0.23.0 lib/slim_lint/lint.rb
slim_lint-0.22.1 lib/slim_lint/lint.rb
slim_lint-0.22.0 lib/slim_lint/lint.rb
slim_lint-0.21.1 lib/slim_lint/lint.rb
slim_lint-0.21.0 lib/slim_lint/lint.rb
slim_lint-0.20.2 lib/slim_lint/lint.rb
slim_lint-0.20.1 lib/slim_lint/lint.rb
slim_lint-0.20.0 lib/slim_lint/lint.rb
slim_lint-0.19.0 lib/slim_lint/lint.rb
slim_lint-0.18.0 lib/slim_lint/lint.rb
slim_lint-0.17.1 lib/slim_lint/lint.rb