Class: ArchSpec::Rules::ForbidDependenciesRule
- Inherits:
-
DependencyRule
- Object
- DependencyRule
- ArchSpec::Rules::ForbidDependenciesRule
- 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
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/archspec/rules/dependency_rules.rb', line 63 def evaluate(graph) relevant_edges(graph).flat_map do |edge| forbidden = target_components(graph, edge) & targets forbidden.map do |target| Diagnostic.new( rule: id, message: "#{source} must not depend on #{target}", location: edge.location, evidence: "#{edge.from_constant || edge.from_path} #{edge.type} #{edge_target(edge)}" ) end end end |
#id ⇒ Object
59 60 61 |
# File 'lib/archspec/rules/dependency_rules.rb', line 59 def id "dependencies.forbid" end |