Class: Quality::Tools::Scalastyle

Inherits:
Tool
  • Object
show all
Defined in:
lib/quality/tools/scalastyle.rb

Overview

Adds ‘scalastyle’ tool support to quality gem

Instance Method Summary collapse

Methods inherited from Tool

#initialize

Constructor Details

This class inherits a constructor from Quality::Tools::Tool

Instance Method Details

#quality_scalastyleObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/quality/tools/scalastyle.rb', line 17

def quality_scalastyle
  ratchet_quality_cmd('scalastyle',
                      args: scalastyle_args,
                      gives_error_code_on_no_relevant_code: true,
                      gives_error_code_on_violations: true) do |line|
    if line =~ /file=/
      1
    else
      0
    end
  end
end

#scalastyle_argsObject



7
8
9
10
11
12
13
14
15
# File 'lib/quality/tools/scalastyle.rb', line 7

def scalastyle_args
  c = " -c '#{scalastyle_config}' " if scalastyle_config
  x = " -x '#{scalastyle_exclude}' " if scalastyle_exclude
  args = ''
  args += c if c
  args += x if x
  args += scala_files.join(' ')
  args
end