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

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

Overview

Packages named "Application Schema" or with applicationSchema stereotype should have at least one class with a GML stereotype.

Constant Summary collapse

GML_STEREOTYPES =
%w[FeatureType Type DataType CodeList
Enumeration ObjectType].freeze

Instance Method Summary collapse

Methods inherited from LintRule

name

Instance Method Details

#check(model) ⇒ Object



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

def check(model)
  classes = (model.collections[:objects] || [])
             .select { |o| o.object_type == "Class" }
  classes_without_stereo = classes.select { |c| stereotype_refs(c).empty? }
  classes_without_stereo.map do |klass|
    offense(entity_id: klass.object_id,
            entity_name: klass.name,
            message: "Class has no applied stereotype",
            severity: :info)
  end
end