spec/test_projects/one_file_project/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
      @classes.each {|klass| klass.lines = count_lines_in_class(klass)}
      prune_dependencies
      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 @classes . each { | klass | klass . lines = count_lines_in_class ( klass ) } prune_dependencies 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
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