Class: EagerEye::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/eager_eye/analyzer.rb

Constant Summary collapse

DETECTOR_CLASSES =
{
  loop_association: Detectors::LoopAssociation,
  serializer_nesting: Detectors::SerializerNesting,
  missing_counter_cache: Detectors::MissingCounterCache,
  custom_method_query: Detectors::CustomMethodQuery,
  count_in_iteration: Detectors::CountInIteration
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(paths: nil) ⇒ Analyzer

Returns a new instance of Analyzer.



17
18
19
20
# File 'lib/eager_eye/analyzer.rb', line 17

def initialize(paths: nil)
  @paths = Array(paths || EagerEye.configuration.app_path)
  @issues = []
end

Instance Attribute Details

#issuesObject (readonly)

Returns the value of attribute issues.



15
16
17
# File 'lib/eager_eye/analyzer.rb', line 15

def issues
  @issues
end

#pathsObject (readonly)

Returns the value of attribute paths.



15
16
17
# File 'lib/eager_eye/analyzer.rb', line 15

def paths
  @paths
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
# File 'lib/eager_eye/analyzer.rb', line 22

def run
  @issues = []

  ruby_files.each do |file_path|
    analyze_file(file_path)
  end

  @issues
end