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_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
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/archspec/rules/dependency_rules.rb', line 51 def evaluate(graph) relevant_edges(graph).flat_map do |edge| target_components(graph, 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: "#{edge.from_constant || edge.from_path} #{edge.type} #{edge_target(edge)}" ) end end end |
#id ⇒ Object
47 48 49 |
# File 'lib/archspec/rules/dependency_rules.rb', line 47 def id 'dependencies.allow' end |