lib/warder/code_complexity_runner.rb in warder-0.1.1 vs lib/warder/code_complexity_runner.rb in warder-0.1.2
- old
+ new
@@ -1,18 +1,16 @@
module Warder
# responsible for run code complexity validation
class CodeComplexityRunner < Runner
FLOG_SCORE = SCORE
+ COMMAND_NAME = 'flog'
+ TOTAL_REGEXP = /^\s+\d+.\d+\:.*(total|average)$/
- def initialize(options = {})
- @options = options
- end
-
private
- def command
- "flog -a -c -g -m #{@options.files}"
+ def command_with_options
+ "#{COMMAND_NAME} -a -c -g -m #{@options.files}"
end
def failed?(line)
match = line.match(/^\s+(\d+.\d+)\:\s.*$/)
return false if total?(line)
@@ -22,9 +20,9 @@
def printable?(line)
failed?(line)
end
def total?(line)
- line.match(/^\s+\d+.\d+\:.*(total|average)$/)
+ TOTAL_REGEXP.match(line)
end
end
end