Module: Undercover::Checkstyle::CLI

Defined in:
lib/undercover/checkstyle/cli.rb

Class Method Summary collapse

Class Method Details

.changeset(opts) ⇒ Object



29
30
31
32
# File 'lib/undercover/checkstyle/cli.rb', line 29

def self.changeset(opts)
  git_dir = File.join(opts.path, opts.git_dir)
  Undercover::Changeset.new(git_dir, opts.compare)
end

.run(args) ⇒ Object



9
10
11
12
13
14
# File 'lib/undercover/checkstyle/cli.rb', line 9

def self.run(args)
  opts = Undercover::Options.new.parse(args)
  syntax_version(opts.syntax_version)

  run_report(opts)
end

.run_report(opts) ⇒ Object



16
17
18
19
20
21
# File 'lib/undercover/checkstyle/cli.rb', line 16

def self.run_report(opts)
  report = Undercover::Report.new(changeset(opts), opts).build
  flagged = report.flagged_results
  puts Undercover::Checkstyle::Formatter.new(flagged)
  flagged.any? ? 1 : 0
end

.syntax_version(version) ⇒ Object



23
24
25
26
27
# File 'lib/undercover/checkstyle/cli.rb', line 23

def self.syntax_version(version)
  return unless version

  Imagen.parser_version = version
end