Class: Watchr::Analyse

Inherits:
Object
  • Object
show all
Defined in:
lib/watchr/analyse.rb

Overview

Code analyse information for a given path. Returns list of files, each containing its own detailed data for used metrics.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Analyse

Run the analyse.

Parameters:

  • Path (String)

    to code folders.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/watchr/analyse.rb', line 23

def initialize(path)
  files = Paths.files_by_dirs(['rb'], path)

  # Flay essentially cant be done on file level because its first class
  # citizen is duplication of code between files. Its done once for all
  # the files in the analyse and results are injected to the proper file
  # later.
  # flay = Watchr::FlayMetric::Report.new(files)

  # Create report for each file.
  @files = files.map do |file|
    Watchr::FileAnalyse.new(file).tap { |file|
      # file.flay(flay.duplications_by_file(file))
    }
  end

  @path = path
end

Instance Attribute Details

#filesObject (readonly)

Analysed file data.



16
17
18
# File 'lib/watchr/analyse.rb', line 16

def files
  @files
end

#pathObject (readonly)

Analysed file data.



16
17
18
# File 'lib/watchr/analyse.rb', line 16

def path
  @path
end