Sha256: 7fdb0962458c1fc66af5805dec28d3c13e644313b61f88b6a63347d71395c3e9

Contents?: true

Size: 847 Bytes

Versions: 278

Compression:

Stored size: 847 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  # An Error exception is different from an Offense with severity 'error'
  # When this exception is raised, it means that RuboCop is unable to perform
  # a requested action (probably due to misconfiguration) and must stop
  # immediately, rather than carrying on
  class Error < StandardError; end

  class ValidationError < Error; end

  # A wrapper to display errored location of analyzed file.
  class ErrorWithAnalyzedFileLocation < Error
    def initialize(cause:, node:, cop:)
      super()
      @cause = cause
      @cop = cop
      @location = node.is_a?(RuboCop::AST::Node) ? node.loc : node
    end

    attr_reader :cause, :cop

    def line
      @location&.line
    end

    def column
      @location&.column
    end

    def message
      "cause: #{cause.inspect}"
    end
  end
end

Version data entries

278 entries across 269 versions & 26 rubygems

Version Path
rubocop-1.74.0 lib/rubocop/error.rb
rubocop-1.73.2 lib/rubocop/error.rb
siteimprove_api_client-1.0.1 vendor/bundle/ruby/3.2.0/gems/rubocop-1.73.1/lib/rubocop/error.rb
rubocop-1.73.1 lib/rubocop/error.rb
rubocop-1.73.0 lib/rubocop/error.rb
rubocop-1.72.2 lib/rubocop/error.rb
rubocop-1.72.1 lib/rubocop/error.rb
rubocop-1.72.0 lib/rubocop/error.rb
rubocop-1.71.2 lib/rubocop/error.rb
tailscale_middleware-0.0.3 vendor/cache/ruby/3.4.0/gems/rubocop-1.71.1/lib/rubocop/error.rb
rubocop-1.71.1 lib/rubocop/error.rb
rubocop-1.71.0 lib/rubocop/error.rb
rubocop-1.70.0 lib/rubocop/error.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/rubocop-1.64.1/lib/rubocop/error.rb
rubocop-1.69.2 lib/rubocop/error.rb
rubocop-1.69.1 lib/rubocop/error.rb
rubocop-1.69.0 lib/rubocop/error.rb
rubocop-1.68.0 lib/rubocop/error.rb
rubocop-1.67.0 lib/rubocop/error.rb
rubocop-1.66.1 lib/rubocop/error.rb