Class: Ea::Lint::Rules::MissingStereotypeRule

Inherits:
LintRule
  • Object
show all
Defined in:
lib/ea/lint/rules/missing_stereotype.rb

Overview

Flags classes with no applied stereotype. Stereotype detection walks t_xref for @STEREO;Name=...; blocks referencing the class's ea_guid.

Instance Method Summary collapse

Methods inherited from LintRule

name

Instance Method Details

#check(model) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ea/lint/rules/missing_stereotype.rb', line 12

def check(model)
  classes = (model.collections[:objects] || [])
             .select { |o| o.object_type == "Class" }
  xrefs = model.collections[:xrefs] || []
  classes.map do |klass|
    next nil if stereotype_name_for(klass, xrefs)

    offense(entity_id: klass.object_id,
            entity_name: klass.name,
            message: "Class has no applied stereotype",
            severity: :info)
  end.compact
end