Sha256: ed37230d0c0a53d278accdebf45f269a2ef79d517ac03cae50b31b609e32f8f5

Contents?: true

Size: 776 Bytes

Versions: 7

Compression:

Stored size: 776 Bytes

Contents

module Warder
  # responsible for run code complexity validation
  class CodeComplexityRunner < Runner
    CLI_OPTION = 'c'
    CLI_FULL_OPTION = 'code-complexity'
    DESCRIPTION = 'Run code complexity validation'
    COMMAND_NAME = 'flog'
    FAILURE_THRESHOLD = SCORE
    FAILURE_REGEXP = /^\s+(?<issues>\d+.\d+)\:\s.*$/
    TOTAL_REGEXP = /^\s+\d+.\d+\:.*(total|average)$/

    private

    def command_with_options
      "#{COMMAND_NAME} -a -c -g -m #{@options.files}"
    end

    def number_of_issues(line)
      return 0 if total?(line)
      super
    end

    def failed?(line)
      number_of_issues(line) != 0
    end

    def printable?(line)
      super && failed?(line)
    end

    def total?(line)
      self.class::TOTAL_REGEXP.match(line)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
warder-0.3.4 lib/warder/code_complexity_runner.rb
warder-0.3.2 lib/warder/code_complexity_runner.rb
warder-0.3.1 lib/warder/code_complexity_runner.rb
warder-0.3.0 lib/warder/code_complexity_runner.rb
warder-0.2.4 lib/warder/code_complexity_runner.rb
warder-0.2.3 lib/warder/code_complexity_runner.rb
warder-0.2.2 lib/warder/code_complexity_runner.rb