Class: ArchSpec::Rules::Naming::Forbidden

Inherits:
Object
  • Object
show all
Defined in:
lib/archspec/rules/naming_rules.rb

Overview

Forbids any selected method from existing. Rule id naming.forbidden.

Instance Method Summary collapse

Instance Method Details

#diagnostics(selected, rule, _graph) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/archspec/rules/naming_rules.rb', line 81

def diagnostics(selected, rule, _graph)
  selected.map do |definition, _match|
    evidence = "#{definition.owner} defines #{definition.scope} method #{definition.name} " \
               "(#{rule.selector.describe})"
    Diagnostic.new(
      rule: id,
      message: "#{definition.owner} must not define ##{definition.name}",
      location: definition.location,
      evidence: evidence
    )
  end
end

#idObject



77
78
79
# File 'lib/archspec/rules/naming_rules.rb', line 77

def id
  'naming.forbidden'
end