Class: ArchSpec::Rules::AllowDependenciesRule
- Inherits:
-
DependencyRule
- Object
- DependencyRule
- ArchSpec::Rules::AllowDependenciesRule
- Defined in:
- lib/archspec/rules/dependency_rules.rb
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
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/archspec/rules/dependency_rules.rb', line 42 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
38 39 40 |
# File 'lib/archspec/rules/dependency_rules.rb', line 38 def id "dependencies.allow" end |