Class: EagerEye::Detectors::DecoratorNPlusOne
Constant Summary
collapse
- DECORATOR_PATTERNS =
%w[Draper::Decorator SimpleDelegator Delegator].freeze
- OBJECT_REFS =
%i[object __getobj__ source model].freeze
Concerns::ClassInspector::ACTIVE_STORAGE_METHODS, Concerns::ClassInspector::HAS_MANY_ASSOCIATIONS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
default_severity
Class Method Details
.detector_name ⇒ Object
13
14
15
|
# File 'lib/eager_eye/detectors/decorator_n_plus_one.rb', line 13
def self.detector_name
:decorator_n_plus_one
end
|
Instance Method Details
#detect(ast, file_path) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/eager_eye/detectors/decorator_n_plus_one.rb', line 17
def detect(ast, file_path)
return [] unless ast
issues = []
traverse_ast(ast) do |node|
next unless node.type == :class && decorator_class?(node)
find_association_accesses(node, file_path, issues)
end
issues
end
|