Class: Packwerk::ReferenceOffense

Inherits:
Offense
  • Object
show all
Extended by:
T::Helpers, T::Sig
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

Returns a new instance of ReferenceOffense.



25
26
27
28
29
# File 'lib/packwerk/reference_offense.rb', line 25

def initialize(reference:, violation_type:, message:, location: nil)
  super(file: T.must(reference.relative_path), message: message, location: location)
  @reference = reference
  @violation_type = violation_type
end

Instance Attribute Details

#referenceObject (readonly)

Returns the value of attribute reference.



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

def reference
  @reference
end

#violation_typeObject (readonly)

Returns the value of attribute violation_type.



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

def violation_type
  @violation_type
end