From 5f49582b4bafba86485f21b53de765c7ed6833c3 Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sun, 4 Aug 2013 23:03:39 +0200 Subject: [PATCH] Adjust flay/flog scores --- config/flay.yml | 2 +- config/flog.yml | 2 +- lib/mutant/cli.rb | 57 ++++++++++++++++++++------------------------ lib/mutant/config.rb | 3 ++- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/config/flay.yml b/config/flay.yml index 98a27b9a..05b35428 100644 --- a/config/flay.yml +++ b/config/flay.yml @@ -1,3 +1,3 @@ --- threshold: 16 -total_score: 758 +total_score: 739 diff --git a/config/flog.yml b/config/flog.yml index d39172f7..46da0862 100644 --- a/config/flog.yml +++ b/config/flog.yml @@ -1,2 +1,2 @@ --- -threshold: 20.5 +threshold: 20.0 diff --git a/lib/mutant/cli.rb b/lib/mutant/cli.rb index 9feb1095..e5a19b14 100644 --- a/lib/mutant/cli.rb +++ b/lib/mutant/cli.rb @@ -59,6 +59,7 @@ module Mutant def config Config.new( :cache => @cache, + :zombie => @zombie, :debug => debug?, :matcher => matcher, :filter => filter, @@ -154,26 +155,6 @@ module Mutant @filters << klass.new(filter) end - # Set fail fast - # - # @api private - # - # @return [undefined] - # - def set_fail_fast - @fail_fast = true - end - - # Set debug mode - # - # @api private - # - # @return [undefined] - # - def set_debug - @debug = true - end - # Set strategy # # @param [Strategy] strategy @@ -204,8 +185,6 @@ module Mutant builder.separator '' builder.separator 'Strategies:' - builder.on('--zombie', 'Run mutant zombified') - add_strategies(builder) add_options(builder) end @@ -237,7 +216,7 @@ module Mutant # Add strategies # - # @param [Object] + # @param [Object] opts # # @return [undefined] # @@ -258,9 +237,27 @@ module Mutant end end + # Add environmental options + # + # @param [Object] opts + # + # @return [undefined] + # + # @api private + # + def add_environmental_options(opts) + opts.on('--zombie', 'Run mutant zombified') do + @zombie = true + end.on('-I', 'Add directory to $LOAD_PATH') do |directory| + $LOAD_PATH << directory + end.on('-r', '--require NAME', 'Require file with NAME') do |name| + require name + end + end + # Add options # - # @param [Object] + # @param [Object] opts # # @return [undefined] # @@ -271,18 +268,16 @@ module Mutant opts.separator 'Options:' opts.on('--version', 'Print mutants version') do |name| - puts "mutant-#{Mutant::VERSION}" + puts("mutant-#{Mutant::VERSION}") Kernel.exit(0) - end.on('-r', '--require NAME', 'Require file with NAME') do |name| - require name end.on('--code FILTER', 'Adds a code filter') do |filter| - add_filter Mutation::Filter::Code, filter + add_filter(Mutation::Filter::Code, filter) end.on('--fail-fast', 'Fail fast') do - set_fail_fast + @fail_fast = true end.on('-d', '--debug', 'Enable debugging output') do - set_debug + @debug = true end.on_tail('-h', '--help', 'Show this message') do - puts opts + puts(opts) exit end end diff --git a/lib/mutant/config.rb b/lib/mutant/config.rb index 47277312..4850c582 100644 --- a/lib/mutant/config.rb +++ b/lib/mutant/config.rb @@ -4,7 +4,8 @@ module Mutant # The configuration of a mutator run class Config include Adamantium::Flat, Anima.new( - :cache, :debug, :strategy, :matcher, :filter, :reporter, :fail_fast + :cache, :debug, :strategy, :matcher, :filter, + :reporter, :fail_fast, :zombie ) # Enumerate subjects