Class: EagerEye::Detectors::CustomMethodQuery
- Defined in:
- lib/eager_eye/detectors/custom_method_query.rb
Constant Summary collapse
- QUERY_METHODS =
%i[ where find_by find_by! exists? find first last take pluck ids count sum average minimum maximum ].freeze
- ITERATION_METHODS =
%i[each map select find_all reject collect detect find_index flat_map].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.detector_name ⇒ Object
26 27 28 |
# File 'lib/eager_eye/detectors/custom_method_query.rb', line 26 def self.detector_name :custom_method_query end |
Instance Method Details
#detect(ast, file_path) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/eager_eye/detectors/custom_method_query.rb', line 30 def detect(ast, file_path) return [] unless ast @issues = [] @file_path = file_path find_iteration_blocks(ast) do |block_body, block_var| check_block_for_query_methods(block_body, block_var) end @issues end |