mutant 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -11
- data/.rspec +0 -1
- data/.travis.yml +14 -3
- data/Changelog.md +3 -0
- data/Gemfile +5 -1
- data/Gemfile.devtools +49 -0
- data/Guardfile +18 -0
- data/README.md +67 -0
- data/Rakefile +4 -1
- data/TODO +13 -0
- data/bin/mutant +14 -0
- data/bin/zombie +14 -0
- data/config/flay.yml +3 -0
- data/config/flog.yml +2 -0
- data/config/roodi.yml +26 -0
- data/config/site.reek +93 -0
- data/config/yardstick.yml +2 -0
- data/lib/inflector.rb +7 -0
- data/lib/inflector/defaults.rb +62 -0
- data/lib/inflector/inflections.rb +209 -0
- data/lib/inflector/methods.rb +149 -0
- data/lib/inflector/version.rb +3 -0
- data/lib/mutant.rb +96 -21
- data/lib/mutant/cli.rb +309 -0
- data/lib/mutant/color.rb +61 -0
- data/lib/mutant/context.rb +36 -0
- data/lib/mutant/context/scope.rb +138 -0
- data/lib/mutant/differ.rb +100 -0
- data/lib/mutant/helper.rb +38 -0
- data/lib/mutant/killer.rb +136 -0
- data/lib/mutant/killer/forking.rb +41 -0
- data/lib/mutant/killer/rspec.rb +49 -0
- data/lib/mutant/killer/static.rb +19 -0
- data/lib/mutant/loader.rb +129 -0
- data/lib/mutant/matcher.rb +55 -0
- data/lib/mutant/matcher/chain.rb +66 -0
- data/lib/mutant/matcher/method.rb +173 -0
- data/lib/mutant/matcher/method/classifier.rb +126 -0
- data/lib/mutant/matcher/method/instance.rb +67 -0
- data/lib/mutant/matcher/method/singleton.rb +141 -0
- data/lib/mutant/matcher/object_space.rb +114 -0
- data/lib/mutant/matcher/scope_methods.rb +127 -0
- data/lib/mutant/mutation.rb +101 -12
- data/lib/mutant/mutation/filter.rb +75 -0
- data/lib/mutant/mutation/filter/code.rb +68 -0
- data/lib/mutant/mutation/filter/regexp.rb +39 -0
- data/lib/mutant/mutation/filter/whitelist.rb +47 -0
- data/lib/mutant/mutator.rb +134 -30
- data/lib/mutant/mutator/node.rb +163 -0
- data/lib/mutant/mutator/node/arguments.rb +24 -0
- data/lib/mutant/mutator/node/block.rb +24 -0
- data/lib/mutant/mutator/node/define.rb +24 -0
- data/lib/mutant/mutator/node/if_statement.rb +93 -0
- data/lib/mutant/mutator/node/literal.rb +54 -0
- data/lib/mutant/mutator/node/literal/array.rb +28 -0
- data/lib/mutant/mutator/node/literal/boolean.rb +49 -0
- data/lib/mutant/mutator/node/literal/dynamic.rb +24 -0
- data/lib/mutant/mutator/node/literal/empty_array.rb +26 -0
- data/lib/mutant/mutator/node/literal/fixnum.rb +37 -0
- data/lib/mutant/mutator/node/literal/float.rb +48 -0
- data/lib/mutant/mutator/node/literal/hash.rb +89 -0
- data/lib/mutant/mutator/node/literal/nil.rb +25 -0
- data/lib/mutant/mutator/node/literal/range.rb +94 -0
- data/lib/mutant/mutator/node/literal/regex.rb +43 -0
- data/lib/mutant/mutator/node/literal/string.rb +26 -0
- data/lib/mutant/mutator/node/literal/symbol.rb +26 -0
- data/lib/mutant/mutator/node/noop.rb +55 -0
- data/lib/mutant/mutator/node/receiver_case.rb +140 -0
- data/lib/mutant/mutator/node/return.rb +31 -0
- data/lib/mutant/mutator/node/send.rb +112 -0
- data/lib/mutant/mutator/registry.rb +48 -0
- data/lib/mutant/mutator/util.rb +87 -0
- data/lib/mutant/random.rb +24 -27
- data/lib/mutant/reporter.rb +48 -30
- data/lib/mutant/reporter/cli.rb +221 -0
- data/lib/mutant/reporter/null.rb +42 -0
- data/lib/mutant/reporter/stats.rb +64 -0
- data/lib/mutant/runner.rb +112 -0
- data/lib/mutant/strategy.rb +42 -0
- data/lib/mutant/strategy/rspec.rb +59 -0
- data/lib/mutant/strategy/rspec/example_lookup.rb +122 -0
- data/lib/mutant/subject.rb +115 -0
- data/lib/mutant/support/method_object.rb +31 -0
- data/locator.rb +87 -0
- data/mutant.gemspec +21 -21
- data/spec/integration/mutant/differ_spec.rb +15 -0
- data/spec/integration/mutant/loader_spec.rb +21 -0
- data/spec/integration/mutant/method_matching_spec.rb +269 -0
- data/spec/integration/mutant/rspec_killer_spec.rb +24 -0
- data/spec/integration/mutant/runner_spec.rb +26 -0
- data/spec/integration/mutant/zombie_spec.rb +8 -0
- data/spec/rcov.opts +7 -0
- data/spec/shared/command_method_behavior.rb +7 -0
- data/spec/shared/each_method_behaviour.rb +15 -0
- data/spec/shared/hash_method_behavior.rb +17 -0
- data/spec/shared/idempotent_method_behavior.rb +7 -0
- data/spec/shared/invertible_method_behaviour.rb +9 -0
- data/spec/shared/method_filter_parse_behavior.rb +16 -0
- data/spec/shared/method_match_behavior.rb +39 -0
- data/spec/shared/mutator_behavior.rb +46 -0
- data/spec/spec_helper.rb +11 -14
- data/spec/support/compress_helper.rb +10 -0
- data/spec/support/rspec.rb +22 -0
- data/spec/support/test_app.rb +5 -0
- data/spec/support/zombie.rb +141 -0
- data/spec/unit/mutant/cli/class_methods/new_spec.rb +87 -0
- data/spec/unit/mutant/cli/class_methods/run_spec.rb +38 -0
- data/spec/unit/mutant/context/root_spec.rb +11 -0
- data/spec/unit/mutant/context/scope/class_methods/build_spec.rb +29 -0
- data/spec/unit/mutant/context/scope/root_spec.rb +22 -0
- data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +27 -0
- data/spec/unit/mutant/killer/fail_ques_spec.rb +39 -0
- data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +32 -0
- data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +33 -0
- data/spec/unit/mutant/loader/rubinius/class_methods/run_spec.rb +42 -0
- data/spec/unit/mutant/matcher/chain/each_spec.rb +37 -0
- data/spec/unit/mutant/matcher/chain/matchers_spec.rb +12 -0
- data/spec/unit/mutant/matcher/class_methods/from_string_spec.rb +49 -0
- data/spec/unit/mutant/matcher/class_methods/parse_spec.rb +12 -0
- data/spec/unit/mutant/matcher/each_spec.rb +14 -0
- data/spec/unit/mutant/matcher/method/class_methods/parse_spec.rb +21 -0
- data/spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb +34 -0
- data/spec/unit/mutant/matcher/method/method_spec.rb +11 -0
- data/spec/unit/mutant/matcher/object_space/class_methods/parse_spec.rb +24 -0
- data/spec/unit/mutant/matcher/object_space/each_spec.rb +31 -0
- data/spec/unit/mutant/mutator/each_spec.rb +25 -0
- data/spec/unit/mutant/mutator/emit_new_spec.rb +51 -0
- data/spec/unit/mutant/mutator/emit_spec.rb +52 -0
- data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +36 -0
- data/spec/unit/mutant/mutator/node/define/mutation_spec.rb +47 -0
- data/spec/unit/mutant/mutator/node/if_statement/mutation_spec.rb +30 -0
- data/spec/unit/mutant/mutator/node/literal/array_spec.rb +30 -0
- data/spec/unit/mutant/mutator/node/literal/boolean/mutation_spec.rb +23 -0
- data/spec/unit/mutant/mutator/node/literal/empty_array_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/literal/float_spec.rb +25 -0
- data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +34 -0
- data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +13 -0
- data/spec/unit/mutant/mutator/node/literal/range_spec.rb +35 -0
- data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +23 -0
- data/spec/unit/mutant/mutator/node/literal/string_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +17 -0
- data/spec/unit/mutant/mutator/node/receiver_case/mutation_spec.rb +27 -0
- data/spec/unit/mutant/mutator/node/return/mutation_spec.rb +21 -0
- data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +78 -0
- data/spec/unit/mutant/mutator/self_spec.rb +7 -0
- data/spec/unit/mutant/subject/class_methods/new_spec.rb +13 -0
- data/spec/unit/mutant/subject/context_spec.rb +14 -0
- data/spec/unit/mutant/subject/each_spec.rb +35 -0
- data/spec/unit/mutant/subject/node_spec.rb +13 -0
- data/tasks/metrics/ci.rake +7 -0
- data/tasks/metrics/flay.rake +41 -0
- data/tasks/metrics/flog.rake +43 -0
- data/tasks/metrics/heckle.rake +216 -0
- data/tasks/metrics/metric_fu.rake +31 -0
- data/tasks/metrics/reek.rake +15 -0
- data/tasks/metrics/roodi.rake +15 -0
- data/tasks/metrics/yardstick.rake +23 -0
- data/tasks/spec.rake +45 -0
- data/tasks/yard.rake +9 -0
- data/test_app/.rspec +1 -0
- data/test_app/lib/test_app.rb +5 -0
- data/test_app/lib/test_app/literal.rb +32 -0
- data/test_app/spec/shared/command_method_behavior.rb +7 -0
- data/test_app/spec/shared/each_method_behaviour.rb +15 -0
- data/test_app/spec/shared/hash_method_behavior.rb +17 -0
- data/test_app/spec/shared/idempotent_method_behavior.rb +7 -0
- data/test_app/spec/shared/invertible_method_behaviour.rb +9 -0
- data/test_app/spec/shared/method_filter_parse_behavior.rb +16 -0
- data/test_app/spec/shared/method_match_behavior.rb +39 -0
- data/test_app/spec/shared/mutator_behavior.rb +44 -0
- data/test_app/spec/spec_helper.rb +7 -0
- data/test_app/spec/unit/test_app/literal/command_spec.rb +9 -0
- data/test_app/spec/unit/test_app/literal/string_spec.rb +9 -0
- metadata +346 -124
- data/.rvmrc +0 -1
- data/Readme.md +0 -13
- data/exe/mutate +0 -6
- data/lib/mutant/extensions.rb +0 -8
- data/lib/mutant/formatter.rb +0 -19
- data/lib/mutant/implementation.rb +0 -70
- data/lib/mutant/literal.rb +0 -147
- data/lib/mutant/method.rb +0 -31
- data/lib/mutant/mutatee.rb +0 -61
- data/lib/mutant/node.rb +0 -26
- data/lib/mutant/runners/rspec.rb +0 -34
- data/lib/mutant/version.rb +0 -3
- data/spec/functional/class_spec.rb +0 -46
- data/spec/functional/instance_method/array_spec.rb +0 -53
- data/spec/functional/instance_method/boolean_spec.rb +0 -101
- data/spec/functional/instance_method/call_spec.rb +0 -161
- data/spec/functional/instance_method/fixnum_spec.rb +0 -53
- data/spec/functional/instance_method/float_spec.rb +0 -53
- data/spec/functional/instance_method/hash_spec.rb +0 -53
- data/spec/functional/instance_method/if_spec.rb +0 -57
- data/spec/functional/instance_method/ivar_assign_spec.rb +0 -62
- data/spec/functional/instance_method/range_spec.rb +0 -53
- data/spec/functional/instance_method/regex_spec.rb +0 -55
- data/spec/functional/instance_method/string_spec.rb +0 -53
- data/spec/functional/instance_method/symbol_spec.rb +0 -53
- data/spec/functional/reporter/method_loaded_spec.rb +0 -62
- data/spec/functional/reporter/running_mutations_spec.rb +0 -60
- data/spec/functional/runners/rspec_spec.rb +0 -26
- data/spec/functional/singleton_method/array_spec.rb +0 -53
- data/spec/functional/singleton_method/boolean_spec.rb +0 -101
- data/spec/functional/singleton_method/call_spec.rb +0 -161
- data/spec/functional/singleton_method/fixnum_spec.rb +0 -53
- data/spec/functional/singleton_method/float_spec.rb +0 -53
- data/spec/functional/singleton_method/hash_spec.rb +0 -53
- data/spec/functional/singleton_method/if_spec.rb +0 -57
- data/spec/functional/singleton_method/ivar_assign_spec.rb +0 -60
- data/spec/functional/singleton_method/range_spec.rb +0 -53
- data/spec/functional/singleton_method/regex_spec.rb +0 -55
- data/spec/functional/singleton_method/string_spec.rb +0 -53
- data/spec/functional/singleton_method/symbol_spec.rb +0 -53
- data/spec/mutant/extensions_spec.rb +0 -13
- data/spec/mutant/implementation_spec.rb +0 -223
- data/spec/mutant/literal_spec.rb +0 -129
- data/spec/mutant/mutatee_spec.rb +0 -28
- data/spec/mutant/node_spec.rb +0 -41
- data/spec/mutant/random_spec.rb +0 -33
- data/spec/mutant/reporter_spec.rb +0 -17
- data/spec/mutant_spec.rb +0 -28
- data/spec/support/example_group_helpers.rb +0 -11
- data/spec/support/example_helpers.rb +0 -5
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
before_install:
|
|
2
|
+
- gem install bundler
|
|
3
|
+
language: ruby
|
|
4
|
+
script: 'bundle exec rake spec'
|
|
1
5
|
rvm:
|
|
6
|
+
- 1.8.7
|
|
7
|
+
- 1.9.2
|
|
8
|
+
- 1.9.3
|
|
2
9
|
- rbx-18mode
|
|
3
10
|
- rbx-19mode
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
matrix:
|
|
12
|
+
allow_failures:
|
|
13
|
+
- rvm: rbx-19mode
|
|
14
|
+
- rvm: 1.8.7
|
|
15
|
+
notifications:
|
|
16
|
+
email:
|
|
17
|
+
- mbj@seonic.net
|
data/Changelog.md
ADDED
data/Gemfile
CHANGED
data/Gemfile.devtools
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
group :development do
|
|
2
|
+
gem 'rake', '~> 0.9.2'
|
|
3
|
+
gem 'rspec', '~> 2.12.0'
|
|
4
|
+
gem 'yard', '~> 0.8.3'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
group :guard do
|
|
8
|
+
gem 'guard', '~> 1.5.4'
|
|
9
|
+
gem 'guard-bundler', '~> 1.0.0'
|
|
10
|
+
gem 'guard-rspec', '~> 2.1.1'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
group :benchmarks do
|
|
14
|
+
gem 'rbench', '~> 0.2.3'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
platform :jruby do
|
|
18
|
+
group :jruby do
|
|
19
|
+
gem 'jruby-openssl', '~> 0.7.4'
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
group :metrics do
|
|
24
|
+
gem 'flay', '~> 1.4.2'
|
|
25
|
+
gem 'flog', '~> 2.5.1'
|
|
26
|
+
gem 'reek', '~> 1.2.8', :git => 'https://github.com/dkubb/reek.git'
|
|
27
|
+
gem 'roodi', '~> 2.1.0'
|
|
28
|
+
gem 'yardstick', '~> 0.7.0'
|
|
29
|
+
gem 'simplecov'
|
|
30
|
+
|
|
31
|
+
platforms :ruby_18, :ruby_19 do
|
|
32
|
+
# this indirectly depends on ffi which does not build on ruby-head
|
|
33
|
+
gem 'yard-spellcheck', '~> 0.1.5'
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
platforms :mri_18 do
|
|
37
|
+
gem 'arrayfields', '~> 4.7.4' # for metric_fu
|
|
38
|
+
gem 'fattr', '~> 2.2.0' # for metric_fu
|
|
39
|
+
gem 'json', '~> 1.7.3' # for metric_fu rake task
|
|
40
|
+
gem 'map', '~> 6.0.1' # for metric_fu
|
|
41
|
+
gem 'metric_fu', '~> 2.1.1'
|
|
42
|
+
gem 'mspec', '~> 1.5.17'
|
|
43
|
+
gem 'rcov', '~> 1.0.0'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
platforms :rbx do
|
|
47
|
+
gem 'pelusa', '~> 0.2.1'
|
|
48
|
+
end
|
|
49
|
+
end
|
data/Guardfile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
guard :bundler do
|
|
4
|
+
watch('Gemfile')
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
guard :rspec, :all_on_start => false do
|
|
8
|
+
# run all specs if the spec_helper or supporting files files are modified
|
|
9
|
+
watch('spec/spec_helper.rb') { 'spec/unit' }
|
|
10
|
+
watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec/unit' }
|
|
11
|
+
|
|
12
|
+
# run unit specs if associated lib code is modified
|
|
13
|
+
watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}"] }
|
|
14
|
+
watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec/unit' }
|
|
15
|
+
|
|
16
|
+
# run a spec if it is modified
|
|
17
|
+
watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
|
|
18
|
+
end
|
data/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
mutant
|
|
2
|
+
======
|
|
3
|
+
|
|
4
|
+
[](http://travis-ci.org/mbj/mutant)
|
|
5
|
+
[](https://gemnasium.com/mbj/mutant)
|
|
6
|
+
[](https://codeclimate.com/github/mbj/mutant)
|
|
7
|
+
|
|
8
|
+
Mutant is a mutation testing tool for ruby that aims to be better than existing mutation testers.
|
|
9
|
+
The idea is that if code can be changed and your tests don't notice, either that code isn't being covered or it doesn't do anything.
|
|
10
|
+
|
|
11
|
+
Mutant does currently only support 1.9 mode under rubinius or mri.
|
|
12
|
+
|
|
13
|
+
Installation
|
|
14
|
+
------------
|
|
15
|
+
|
|
16
|
+
Install the gem ``mutant`` via your preferred method.
|
|
17
|
+
|
|
18
|
+
Examples
|
|
19
|
+
--------
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
cd your_lib
|
|
23
|
+
# Run mutant on virtus (that uses the dm-2 style spec layout)
|
|
24
|
+
mutant -I lib -r virtus --rspec-dm2 ::Virtus
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Credits
|
|
28
|
+
-------
|
|
29
|
+
|
|
30
|
+
* A [gist](https://gist.github.com/1065789) from [dkubb](https://github.com/dkubb) showing ideas.
|
|
31
|
+
* Older abandoned [mutant](https://github.com/txus/mutant). For motivating me doing this one.
|
|
32
|
+
* [heckle](https://github.com/seattlerb/heckle). For getting me into mutation testing.
|
|
33
|
+
|
|
34
|
+
Contributing
|
|
35
|
+
-------------
|
|
36
|
+
|
|
37
|
+
* Fork the project.
|
|
38
|
+
* Make your feature addition or bug fix.
|
|
39
|
+
* Add tests for it. This is important so I don't break it in a
|
|
40
|
+
future version unintentionally.
|
|
41
|
+
* Commit, do not mess with Rakefile or version
|
|
42
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
|
43
|
+
* Send me a pull request. Bonus points for topic branches.
|
|
44
|
+
|
|
45
|
+
License
|
|
46
|
+
-------
|
|
47
|
+
|
|
48
|
+
Copyright (c) 2012 Markus Schirp
|
|
49
|
+
|
|
50
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
51
|
+
a copy of this software and associated documentation files (the
|
|
52
|
+
"Software"), to deal in the Software without restriction, including
|
|
53
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
54
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
55
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
56
|
+
the following conditions:
|
|
57
|
+
|
|
58
|
+
The above copyright notice and this permission notice shall be
|
|
59
|
+
included in all copies or substantial portions of the Software.
|
|
60
|
+
|
|
61
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
62
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
63
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
64
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
65
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
66
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
67
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
data/TODO
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
* Test mutant with zombie.
|
|
2
|
+
* Allow matches on attr_reader with literal name argument(s)?
|
|
3
|
+
* Allow matches on define_method with literal name argument?
|
|
4
|
+
* Add some kind of a "do not touch me object" that raises on all messages.
|
|
5
|
+
It can be used to make sure each literal value is touched.
|
|
6
|
+
* Replace nil or add "do not touch me object" to literal mutations.
|
|
7
|
+
* Add support remaining dynamic literals
|
|
8
|
+
* Mutate options on Regexp literals
|
|
9
|
+
* Support the numerous Rubinius::AST::SendWithArguments mutations.
|
|
10
|
+
* Fix rubinius to allow setting @vcall_style variable in Rubinius::AST::Send nodes.
|
|
11
|
+
* Aggregate warnings on missing spec files
|
|
12
|
+
* Make sure loader does not change visibility of injected mutants
|
|
13
|
+
* Collect emmited mutants per subtree and do not emit the same subtree twice.
|
data/bin/mutant
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'mutant'
|
|
4
|
+
|
|
5
|
+
namespace =
|
|
6
|
+
if File.basename($0) == 'zombie'
|
|
7
|
+
$stderr.puts('Detected zombie environment...')
|
|
8
|
+
require File.expand_path('../../spec/support/zombie.rb', __FILE__)
|
|
9
|
+
Zombie.setup
|
|
10
|
+
else
|
|
11
|
+
Mutant
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Kernel.exit(namespace::CLI.run(ARGV))
|
data/bin/zombie
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'mutant'
|
|
4
|
+
|
|
5
|
+
namespace =
|
|
6
|
+
if File.basename($0) == 'zombie'
|
|
7
|
+
$stderr.puts('Detected zombie environment...')
|
|
8
|
+
require File.expand_path('../../spec/support/zombie.rb', __FILE__)
|
|
9
|
+
Zombie.setup
|
|
10
|
+
else
|
|
11
|
+
Mutant
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Kernel.exit(namespace::CLI.run(ARGV))
|
data/config/flay.yml
ADDED
data/config/flog.yml
ADDED
data/config/roodi.yml
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
AbcMetricMethodCheck:
|
|
3
|
+
score: 12.2
|
|
4
|
+
AssignmentInConditionalCheck: {}
|
|
5
|
+
CaseMissingElseCheck: {}
|
|
6
|
+
ClassLineCountCheck:
|
|
7
|
+
line_count: 324
|
|
8
|
+
ClassNameCheck:
|
|
9
|
+
pattern: !ruby/regexp /\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/
|
|
10
|
+
ClassVariableCheck: {}
|
|
11
|
+
CyclomaticComplexityBlockCheck:
|
|
12
|
+
complexity: 2
|
|
13
|
+
CyclomaticComplexityMethodCheck:
|
|
14
|
+
complexity: 4
|
|
15
|
+
EmptyRescueBodyCheck: {}
|
|
16
|
+
ForLoopCheck: {}
|
|
17
|
+
MethodLineCountCheck:
|
|
18
|
+
line_count: 9
|
|
19
|
+
MethodNameCheck:
|
|
20
|
+
pattern: !ruby/regexp /\A(?:[a-z\d](?:_?[a-z\d])+[?!=]?|\[\]=?|==|<=>|<<|[+*&|-])\z/
|
|
21
|
+
ModuleLineCountCheck:
|
|
22
|
+
line_count: 327
|
|
23
|
+
ModuleNameCheck:
|
|
24
|
+
pattern: !ruby/regexp /\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/
|
|
25
|
+
ParameterNumberCheck:
|
|
26
|
+
parameter_count: 3
|
data/config/site.reek
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
UncommunicativeParameterName:
|
|
3
|
+
accept: []
|
|
4
|
+
exclude: []
|
|
5
|
+
enabled: true
|
|
6
|
+
reject:
|
|
7
|
+
- !ruby/regexp /^.$/
|
|
8
|
+
- !ruby/regexp /[0-9]$/
|
|
9
|
+
- !ruby/regexp /[A-Z]/
|
|
10
|
+
LargeClass:
|
|
11
|
+
max_methods: 10
|
|
12
|
+
exclude:
|
|
13
|
+
- "Mutant::Matcher::Method" # 13 methods
|
|
14
|
+
enabled: true
|
|
15
|
+
max_instance_variables: 3
|
|
16
|
+
UncommunicativeMethodName:
|
|
17
|
+
accept: []
|
|
18
|
+
exclude: []
|
|
19
|
+
enabled: true
|
|
20
|
+
reject:
|
|
21
|
+
- !ruby/regexp /^[a-z]$/
|
|
22
|
+
- !ruby/regexp /[0-9]$/
|
|
23
|
+
- !ruby/regexp /[A-Z]/
|
|
24
|
+
LongParameterList:
|
|
25
|
+
max_params: 2
|
|
26
|
+
exclude:
|
|
27
|
+
- "Mutant::Context::Constant#initialize" # 3 params
|
|
28
|
+
enabled: true
|
|
29
|
+
overrides: {}
|
|
30
|
+
FeatureEnvy:
|
|
31
|
+
exclude: []
|
|
32
|
+
enabled: true
|
|
33
|
+
ClassVariable:
|
|
34
|
+
exclude: []
|
|
35
|
+
enabled: true
|
|
36
|
+
BooleanParameter:
|
|
37
|
+
exclude: []
|
|
38
|
+
enabled: true
|
|
39
|
+
IrresponsibleModule:
|
|
40
|
+
exclude: []
|
|
41
|
+
enabled: true
|
|
42
|
+
UncommunicativeModuleName:
|
|
43
|
+
accept: []
|
|
44
|
+
exclude: []
|
|
45
|
+
enabled: true
|
|
46
|
+
reject:
|
|
47
|
+
- !ruby/regexp /^.$/
|
|
48
|
+
- !ruby/regexp /[0-9]$/
|
|
49
|
+
NestedIterators:
|
|
50
|
+
ignore_iterators: []
|
|
51
|
+
exclude: []
|
|
52
|
+
enabled: true
|
|
53
|
+
max_allowed_nesting: 1
|
|
54
|
+
LongMethod:
|
|
55
|
+
max_statements: 6
|
|
56
|
+
exclude: []
|
|
57
|
+
enabled: true
|
|
58
|
+
Duplication:
|
|
59
|
+
allow_calls: []
|
|
60
|
+
exclude: []
|
|
61
|
+
enabled: true
|
|
62
|
+
max_calls: 1
|
|
63
|
+
UtilityFunction:
|
|
64
|
+
max_helper_calls: 0
|
|
65
|
+
exclude: []
|
|
66
|
+
enabled: true
|
|
67
|
+
Attribute:
|
|
68
|
+
exclude: []
|
|
69
|
+
enabled: false
|
|
70
|
+
UncommunicativeVariableName:
|
|
71
|
+
accept: []
|
|
72
|
+
exclude: []
|
|
73
|
+
enabled: true
|
|
74
|
+
reject:
|
|
75
|
+
- !ruby/regexp /^.$/
|
|
76
|
+
- !ruby/regexp /[0-9]$/
|
|
77
|
+
- !ruby/regexp /[A-Z]/
|
|
78
|
+
SimulatedPolymorphism:
|
|
79
|
+
exclude: []
|
|
80
|
+
enabled: true
|
|
81
|
+
max_ifs: 1
|
|
82
|
+
DataClump:
|
|
83
|
+
exclude: []
|
|
84
|
+
enabled: true
|
|
85
|
+
max_copies: 2
|
|
86
|
+
min_clump_size: 2
|
|
87
|
+
ControlCouple:
|
|
88
|
+
exclude: []
|
|
89
|
+
enabled: true
|
|
90
|
+
LongYieldList:
|
|
91
|
+
max_params: 1
|
|
92
|
+
exclude: []
|
|
93
|
+
enabled: true
|
data/lib/inflector.rb
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
module Inflector
|
|
2
|
+
Inflector::Inflections.instance.instance_eval do
|
|
3
|
+
plural(/$/, 's')
|
|
4
|
+
plural(/s$/i, 's')
|
|
5
|
+
plural(/us$/i, 'i')
|
|
6
|
+
plural(/(ax|test)is$/i, '\1es')
|
|
7
|
+
plural(/(octop|vir)us$/i, '\1i')
|
|
8
|
+
plural(/(octop|vir)i$/i, '\1i')
|
|
9
|
+
plural(/(alias|status)$/i, '\1es')
|
|
10
|
+
plural(/(bu)s$/i, '\1ses')
|
|
11
|
+
plural(/(buffal|tomat)o$/i, '\1oes')
|
|
12
|
+
plural(/([ti])um$/i, '\1a')
|
|
13
|
+
plural(/([ti])a$/i, '\1a')
|
|
14
|
+
plural(/sis$/i, 'ses')
|
|
15
|
+
plural(/(?:([^f])fe|([lr])f)$/i, '\1\2ves')
|
|
16
|
+
plural(/(hive)$/i, '\1s')
|
|
17
|
+
plural(/([^aeiouy]|qu)y$/i, '\1ies')
|
|
18
|
+
plural(/(x|ch|ss|sh)$/i, '\1es')
|
|
19
|
+
plural(/(matr|vert|ind)(?:ix|ex)$/i, '\1ices')
|
|
20
|
+
plural(/([m|l])ouse$/i, '\1ice')
|
|
21
|
+
plural(/([m|l])ice$/i, '\1ice')
|
|
22
|
+
plural(/^(ox)$/i, '\1en')
|
|
23
|
+
plural(/^(oxen)$/i, '\1')
|
|
24
|
+
plural(/(quiz)$/i, '\1zes')
|
|
25
|
+
|
|
26
|
+
singular(/s$/i, '')
|
|
27
|
+
singular(/i$/i, 'us')
|
|
28
|
+
singular(/(n)ews$/i, '\1ews')
|
|
29
|
+
singular(/([ti])a$/i, '\1um')
|
|
30
|
+
singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i, '\1\2sis')
|
|
31
|
+
singular(/(^analy)ses$/i, '\1sis')
|
|
32
|
+
singular(/([^f])ves$/i, '\1fe')
|
|
33
|
+
singular(/(hive)s$/i, '\1')
|
|
34
|
+
singular(/(tive)s$/i, '\1')
|
|
35
|
+
singular(/([lr])ves$/i, '\1f')
|
|
36
|
+
singular(/([^aeiouy]|qu)ies$/i, '\1y')
|
|
37
|
+
singular(/(s)eries$/i, '\1eries')
|
|
38
|
+
singular(/(m)ovies$/i, '\1ovie')
|
|
39
|
+
singular(/(x|ch|ss|sh)es$/i, '\1')
|
|
40
|
+
singular(/([m|l])ice$/i, '\1ouse')
|
|
41
|
+
singular(/(bus)es$/i, '\1')
|
|
42
|
+
singular(/(o)es$/i, '\1')
|
|
43
|
+
singular(/(shoe)s$/i, '\1')
|
|
44
|
+
singular(/(cris|ax|test)es$/i, '\1is')
|
|
45
|
+
singular(/(octop|vir)i$/i, '\1us')
|
|
46
|
+
singular(/(alias|status)es$/i, '\1')
|
|
47
|
+
singular(/^(ox)en/i, '\1')
|
|
48
|
+
singular(/(vert|ind)ices$/i, '\1ex')
|
|
49
|
+
singular(/(matr)ices$/i, '\1ix')
|
|
50
|
+
singular(/(quiz)zes$/i, '\1')
|
|
51
|
+
singular(/(database)s$/i, '\1')
|
|
52
|
+
|
|
53
|
+
irregular('person', 'people')
|
|
54
|
+
irregular('man', 'men')
|
|
55
|
+
irregular('child', 'children')
|
|
56
|
+
irregular('sex', 'sexes')
|
|
57
|
+
irregular('move', 'moves')
|
|
58
|
+
irregular('cow', 'kine')
|
|
59
|
+
|
|
60
|
+
uncountable(%w(grass equipment information rice money species series fish sheep jeans))
|
|
61
|
+
end
|
|
62
|
+
end
|