<commit_before># encoding: utf-8

namespace :metrics do
  allowed_versions = %w(mri-1.9.3 mri-2.0.0 mri-2.1.0 rbx-1.9.3)

  enabled = begin
    require 'mutant'
  rescue LoadError, NotImplementedError
    false
  end

  config    = Devtools.project.mutant
  enabled &&= config.enabled? && allowed_versions.include?(Devtools.rvm)

  if enabled && !ENV['DEVTOOLS_SELF']
    desc 'Measure mutation coverage'
    task mutant: :coverage do
      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

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

      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<commit_msg>Use mutant CLI correctly in rake task<commit_after># encoding: utf-8

namespace :metrics do
  allowed_versions = %w(mri-1.9.3 mri-2.0.0 mri-2.1.0 rbx-1.9.3)

  enabled = begin
    require 'mutant'
  rescue LoadError, NotImplementedError
    false
  end

  config    = Devtools.project.mutant
  enabled &&= config.enabled? && allowed_versions.include?(Devtools.rvm)

  if enabled && !ENV['DEVTOOLS_SELF']
    desc 'Measure mutation coverage'
    task mutant: :coverage do
      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

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

      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
{'fraction_non_alphanumeric': 0.10736677115987461, 'fraction_numerical': 0.01018808777429467, 'mean_word_length': 2.3904382470119523, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4007387', 'n_tokens_mistral': 835, 'n_tokens_neox': 814, 'n_words': 193}