Class: Ruumba::Analyzer

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

Overview

Generates analyzer objects that, when run, delegate to RuboCop for linting (style, correctness, &c).

Instance Method Summary collapse

Constructor Details

#initialize(opts = nil) ⇒ Analyzer

Returns a new instance of Analyzer.



20
21
22
# File 'lib/ruumba/analyzer.rb', line 20

def initialize(opts = nil)
  @options = opts || {}
end

Instance Method Details

#run(files_or_dirs = ARGV) ⇒ Object

Performs static analysis on the provided directory.

Parameters:

  • dir (Array<String>)

    The directories / files to analyze.



26
27
28
29
30
31
32
33
34
# File 'lib/ruumba/analyzer.rb', line 26

def run(files_or_dirs = ARGV)
  if options[:tmp_folder]
    analyze(File.expand_path(options[:tmp_folder]), files_or_dirs)
  else
    Dir.mktmpdir do |dir|
      analyze(dir, files_or_dirs)
    end
  end
end