Sha256: ee57c083624de2bfdee6546df17c8d377e08884af641e12e52515b7e8d086257

Contents?: true

Size: 975 Bytes

Versions: 4

Compression:

Stored size: 975 Bytes

Contents

# rubocop:disable Metrics/BlockLength
namespace :metrics do
  config = Devtools.project.mutant

  desc 'Measure mutation coverage'
  task mutant: :coverage do
    require 'mutant'

    namespace =
      if config.zombify
        Mutant.zombify
        Zombie::Mutant
      else
        Mutant
      end

    namespaces = Array(config.namespace).map { |n| "#{n}*" }

    ignore_subjects = config.ignore_subjects.flat_map do |matcher|
      %W[--ignore #{matcher}]
    end

    jobs = ENV.key?('CIRCLECI') ? %w[--jobs 4] : []

    since =
      if config.since
        %W[--since #{config.since}]
      else
        []
      end

    arguments = %W[
      --include lib
      --require #{config.name}
      --use #{config.strategy}
    ].concat(ignore_subjects).concat(namespaces).concat(since).concat(jobs)

    unless namespace::CLI.run(arguments)
      Devtools.notify_metric_violation('Mutant task is not successful')
    end
  end
end
# rubocop:enable Metrics/BlockLength

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
devtools-0.1.23 tasks/metrics/mutant.rake
devtools-0.1.22 tasks/metrics/mutant.rake
devtools-0.1.21 tasks/metrics/mutant.rake
devtools-0.1.20 tasks/metrics/mutant.rake