lib/quality/rake/task.rb in quality-0.2.8 vs lib/quality/rake/task.rb in quality-0.2.9
- old
+ new
@@ -78,11 +78,11 @@
else
method("quality_#{tool}".to_sym).call
end
end
end
-
+
def ratchet_quality_cmd(cmd,
options,
&process_output_line)
gives_error_code_on_violations ||= options[:gives_error_code_on_violations]
@@ -97,11 +97,11 @@
elsif RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
full_cmd = "#{cmd}.bat"
else
full_cmd = cmd
end
-
+
if !args.nil?
full_cmd = "#{full_cmd} #{args}"
end
IO.popen(full_cmd) do |f|
@@ -145,11 +145,11 @@
end
def quality_cane
if ! File.exist?(".cane")
File.open(".cane", "w") {|f| f.write("-f **/*.rb")}
- end
+ end
ratchet_quality_cmd("cane",
gives_error_code_on_violations: true,
emacs_format: true) { |line|
if line =~ /\(([0-9]*)\):$/
$1.to_i
@@ -204,22 +204,22 @@
if line =~ /^[0-9]*\).* \(mass = ([0-9]*)\)$/
$1.to_i
else
0
end
- }
+ }
end
def quality_rubocop
ratchet_quality_cmd("rubocop",
gives_error_code_on_violations: true,
args: "--format emacs #{ruby_files}") { |line|
if line =~ /^.* file[s|] inspected, (.*) offence[s|] detected$/
- $1.to_i
- else
0
+ else
+ 1
end
- }
+ }
end
def quality
Dir.glob("*_high_water_mark").each { |filename|
puts "Processing #{filename}"