Class: EagerEye::Detectors::CountInIteration
- Defined in:
- lib/eager_eye/detectors/count_in_iteration.rb
Constant Summary collapse
- COUNT_METHODS =
%i[count].freeze
- ITERATION_METHODS =
%i[each map select find_all reject collect each_with_index each_with_object flat_map find_each find_in_batches in_batches array!].freeze
- ARRAY_METHOD_SUFFIXES =
%w[_ids _tags _types _codes _names _values].freeze
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Class Method Details
.detector_name ⇒ Object
11 12 13 |
# File 'lib/eager_eye/detectors/count_in_iteration.rb', line 11 def self.detector_name :count_in_iteration end |
Instance Method Details
#detect(ast, file_path) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/eager_eye/detectors/count_in_iteration.rb', line 15 def detect(ast, file_path) @issues = [] @file_path = file_path return @issues unless ast find_iteration_blocks(ast) do |block_body, block_var| check_for_count_calls(block_body, block_var) end @issues end |