lib/reconn/analyzer.rb
# Analyzes all the ruby files in the given directory and its subdirectories
# @param dir [String] path to the directory
# @return [Array(Array<Class>, Array<Method>, Array<CodeSmell>)] found classes,
#  methods and code smells
Analyzes all the ruby files in the given directory and its subdirectories
Analyzes all the ruby files in the given directory and its subdirectories
def analyze(dir)
      parser = RubyParser.new
      paths = ProjectScanner.scan(dir)
      paths.each do |path|
        @current_path = path
        ast = parser.process(File.binread(path), path)
        process ast
        @current_class = Class.new(:none)
      end
      merged_classes = merge_duplicate_classes
      @classes = merged_classes unless merged_classes.nil?
      @classes.each do |klass|
        klass.lines = count_lines_in_class(klass)
        klass.complexity = count_complexity_in_class(klass)
      end
      prune_dependencies
      find_external_dependencies(paths)
      @smells = find_code_smells
      return @classes, @methods, @smells
    end
def analyze ( dir ) parser = RubyParser . new paths = ProjectScanner . scan ( dir ) paths . each do | path | @current_path = path ast = parser . process ( File . binread ( path ) , path ) process ast @current_class = Class . new ( :none ) end merged_classes = merge_duplicate_classes @classes = merged_classes unless merged_classes . nil? @classes . each do | klass | klass . lines = count_lines_in_class ( klass ) klass . complexity = count_complexity_in_class ( klass ) end prune_dependencies find_external_dependencies ( paths ) @smells = find_code_smells return @classes , @methods , @smells end
Analyzes all the ruby files in the given directory and its subdirectories
Analyzes all the ruby files in the given directory and its subdirectories
# Deletes empty classes #@classes.delete(Class.new(:none))
found classes, methods and code smells
found classes methods and code smells
Array(Array<Class>, Array<Method>, Array<CodeSmell>)
dir
path to the directory
path to the directory