Class: Quality::Tools::Rubocop
- Inherits:
-
Tool
- Object
- Tool
- Quality::Tools::Rubocop
show all
- Defined in:
- lib/quality/tools/rubocop.rb
Overview
Adds ‘rubocop’ tool support to quality gem
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Tool
#initialize
Class Method Details
.count_rubocop_violations(line) ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/quality/tools/rubocop.rb', line 26
def self.count_rubocop_violations(line)
if line =~ /^.* file[s|] inspected, (.*) offence[s|] detected$/
0
elsif line =~ /^warning: .*/
0
else
1
end
end
|
Instance Method Details
#quality_rubocop ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/quality/tools/rubocop.rb', line 18
def quality_rubocop
ratchet_quality_cmd('rubocop',
gives_error_code_on_violations: true,
args: rubocop_args) do |line|
self.class.count_rubocop_violations(line)
end
end
|
#rubocop_args ⇒ Object
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/quality/tools/rubocop.rb', line 7
def rubocop_args
[
'--force-exclusion',
'--require rubocop-minitest',
'--require rubocop-rake',
'--require rubocop-rspec',
'--format emacs',
*ruby_files,
].join(' ')
end
|