11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/ruby-appraiser-rubocop.rb', line 11
def appraise
file_args = Shellwords::join(relevant_files)
file_args = '**/*.rb' if file_args.length > 250_000
rubocop_command = ['rubocop --format emacs',
file_args].flatten.join(' ')
puts rubocop_command if @options[:verbose]
rubocop_output = IO.popen(rubocop_command) { |io| io.read }
file_line_desc_pattern = /^([^:]+):([0-9]+)(\:[0-9]+\:?)?(.*)/
rubocop_output.lines.each do |rubocop_output_line|
next unless rubocop_output_line.match(file_line_desc_pattern)
file = Regexp::last_match(1)
line = Regexp::last_match(2).to_i
desc = Regexp::last_match(4).strip
add_defect(file, line, desc)
end
end
|