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, association_names = Set.new, method_queries = {}) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/eager_eye/detectors/decorator_n_plus_one.rb', line 17
def detect(ast, file_path, association_names = Set.new, method_queries = {})
return [] unless ast
@dynamic_associations = association_names
@method_queries = method_queries
issues = []
traverse_ast(ast) do |node|
next unless node.type == :class && decorator_class?(node)
find_association_accesses(node, file_path, issues)
end
issues
end
|