Sha256: a243f45c6e14dd86b2d71e9d4c03da82d2cea34526ca8c78f17742a8776cdc63

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

# encoding: utf-8

namespace :metrics do
  config  = Devtools.project.mutant

  if !ENV['DEVTOOLS_SELF']
    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

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

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

      status = namespace::CLI.run(arguments)
      if status.nonzero?
        Devtools.notify_metric_violation 'Mutant task is not successful'
      end
    end
  else
    desc 'Measure mutation coverage'
    task mutant: :coverage do
      $stderr.puts 'Mutant is disabled'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
devtools-0.1.2 tasks/metrics/mutant.rake
devtools-0.1.1 tasks/metrics/mutant.rake
devtools-0.1.0 tasks/metrics/mutant.rake