Class: Packwerk::ReferenceOffense

Inherits:
Offense
  • Object
show all
Defined in:
lib/packwerk/reference_offense.rb

Overview

An offense related to a Reference.

Instance Attribute Summary collapse

Attributes inherited from Offense

#file, #location, #message

Instance Method Summary collapse

Methods inherited from Offense

#to_s

Constructor Details

#initialize(reference:, violation_type:, message:, location: nil) ⇒ ReferenceOffense

: (reference: Packwerk::Reference, violation_type: String, message: String, ?location: Node::Location?) -> void



14
15
16
17
18
19
# File 'lib/packwerk/reference_offense.rb', line 14

def initialize(reference:, violation_type:, message:, location: nil)
  file = reference.relative_path #: as !nil
  super(file: file, message: message, location: location)
  @reference = reference
  @violation_type = violation_type
end

Instance Attribute Details

#referenceObject (readonly)

: Reference



8
9
10
# File 'lib/packwerk/reference_offense.rb', line 8

def reference
  @reference
end

#violation_typeObject (readonly)

: String



11
12
13
# File 'lib/packwerk/reference_offense.rb', line 11

def violation_type
  @violation_type
end