Class: ArchSpec::Rules::AllowDependenciesRule
- Inherits:
-
DependencyRule
- Object
- DependencyRule
- ArchSpec::Rules::AllowDependenciesRule
- Defined in:
- lib/archspec/rules/dependency_rules.rb
Overview
Backs ArchSpec::DSL::ComponentProxy#can_only_use. Flags references from the source to any component outside its allowlist.
Instance Attribute Summary
Attributes inherited from DependencyRule
Instance Method Summary collapse
Methods inherited from DependencyRule
#initialize, #merge!, #merge_key
Constructor Details
This class inherits a constructor from ArchSpec::Rules::DependencyRule
Instance Method Details
#evaluate(graph) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/archspec/rules/dependency_rules.rb', line 43 def evaluate(graph) relevant_edges(graph).flat_map do |edge| graph.target_components_for(edge).filter_map do |target| next if target == source || targets.include?(target) Diagnostic.new( rule: id, message: "#{source} may not depend on #{target}", location: edge.location, evidence: "#{graph.edge_source_name(edge)} #{edge.verb} #{edge.to}" ) end end end |
#id ⇒ Object
39 40 41 |
# File 'lib/archspec/rules/dependency_rules.rb', line 39 def id 'dependencies.allow' end |