mutant 0.3.0.beta21 → 0.3.0.beta22

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.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +37 -6
  3. data/.rspec +2 -0
  4. data/.ruby-gemset +1 -0
  5. data/.travis.yml +13 -7
  6. data/Gemfile +8 -3
  7. data/Gemfile.devtools +2 -6
  8. data/Guardfile +22 -8
  9. data/README.md +3 -1
  10. data/Rakefile +3 -0
  11. data/bin/mutant +4 -3
  12. data/config/devtools.yml +1 -1
  13. data/config/flay.yml +1 -1
  14. data/config/flog.yml +1 -1
  15. data/config/reek.yml +7 -6
  16. data/config/rubocop.yml +55 -0
  17. data/lib/mutant.rb +3 -1
  18. data/lib/mutant/cache.rb +2 -0
  19. data/lib/mutant/cli.rb +14 -10
  20. data/lib/mutant/cli/classifier.rb +22 -10
  21. data/lib/mutant/cli/classifier/method.rb +14 -15
  22. data/lib/mutant/cli/classifier/namespace.rb +6 -2
  23. data/lib/mutant/cli/classifier/scope.rb +3 -1
  24. data/lib/mutant/color.rb +7 -3
  25. data/lib/mutant/config.rb +2 -0
  26. data/lib/mutant/constants.rb +5 -4
  27. data/lib/mutant/context.rb +2 -0
  28. data/lib/mutant/context/scope.rb +3 -1
  29. data/lib/mutant/differ.rb +10 -2
  30. data/lib/mutant/killer.rb +4 -1
  31. data/lib/mutant/killer/forked.rb +2 -0
  32. data/lib/mutant/killer/forking.rb +2 -0
  33. data/lib/mutant/killer/rspec.rb +19 -3
  34. data/lib/mutant/killer/static.rb +2 -0
  35. data/lib/mutant/loader.rb +8 -1
  36. data/lib/mutant/matcher.rb +2 -0
  37. data/lib/mutant/matcher/chain.rb +2 -0
  38. data/lib/mutant/matcher/method.rb +15 -3
  39. data/lib/mutant/matcher/method/finder.rb +2 -0
  40. data/lib/mutant/matcher/method/instance.rb +4 -1
  41. data/lib/mutant/matcher/method/singleton.rb +7 -1
  42. data/lib/mutant/matcher/methods.rb +3 -1
  43. data/lib/mutant/matcher/namespace.rb +4 -2
  44. data/lib/mutant/matcher/scope.rb +2 -0
  45. data/lib/mutant/mutation.rb +19 -5
  46. data/lib/mutant/mutation/evil.rb +12 -0
  47. data/lib/mutant/mutation/filter.rb +2 -0
  48. data/lib/mutant/mutation/filter/code.rb +3 -1
  49. data/lib/mutant/mutation/filter/regexp.rb +2 -0
  50. data/lib/mutant/mutation/filter/whitelist.rb +2 -0
  51. data/lib/mutant/mutation/neutral.rb +25 -0
  52. data/lib/mutant/mutator.rb +4 -6
  53. data/lib/mutant/mutator/node.rb +5 -1
  54. data/lib/mutant/mutator/node/argument.rb +2 -0
  55. data/lib/mutant/mutator/node/arguments.rb +2 -0
  56. data/lib/mutant/mutator/node/begin.rb +2 -0
  57. data/lib/mutant/mutator/node/block.rb +2 -0
  58. data/lib/mutant/mutator/node/case.rb +3 -1
  59. data/lib/mutant/mutator/node/connective/binary.rb +3 -1
  60. data/lib/mutant/mutator/node/const.rb +2 -0
  61. data/lib/mutant/mutator/node/define.rb +2 -0
  62. data/lib/mutant/mutator/node/generic.rb +4 -3
  63. data/lib/mutant/mutator/node/if.rb +2 -0
  64. data/lib/mutant/mutator/node/literal.rb +2 -0
  65. data/lib/mutant/mutator/node/literal/array.rb +2 -0
  66. data/lib/mutant/mutator/node/literal/boolean.rb +2 -0
  67. data/lib/mutant/mutator/node/literal/dynamic.rb +2 -0
  68. data/lib/mutant/mutator/node/literal/fixnum.rb +3 -1
  69. data/lib/mutant/mutator/node/literal/float.rb +2 -0
  70. data/lib/mutant/mutator/node/literal/hash.rb +2 -0
  71. data/lib/mutant/mutator/node/literal/nil.rb +2 -0
  72. data/lib/mutant/mutator/node/literal/range.rb +2 -1
  73. data/lib/mutant/mutator/node/literal/regex.rb +2 -0
  74. data/lib/mutant/mutator/node/literal/string.rb +2 -0
  75. data/lib/mutant/mutator/node/literal/symbol.rb +5 -1
  76. data/lib/mutant/mutator/node/masgn.rb +2 -0
  77. data/lib/mutant/mutator/node/mlhs.rb +2 -0
  78. data/lib/mutant/mutator/node/named_value/access.rb +2 -0
  79. data/lib/mutant/mutator/node/named_value/constant_assignment.rb +2 -0
  80. data/lib/mutant/mutator/node/named_value/variable_assignment.rb +3 -1
  81. data/lib/mutant/mutator/node/{cbase.rb → noop.rb} +7 -5
  82. data/lib/mutant/mutator/node/return.rb +2 -0
  83. data/lib/mutant/mutator/node/send.rb +2 -0
  84. data/lib/mutant/mutator/node/send/binary.rb +2 -0
  85. data/lib/mutant/mutator/node/splat.rb +2 -0
  86. data/lib/mutant/mutator/node/super.rb +2 -0
  87. data/lib/mutant/mutator/node/when.rb +3 -1
  88. data/lib/mutant/mutator/node/while.rb +2 -0
  89. data/lib/mutant/mutator/node/zsuper.rb +2 -0
  90. data/lib/mutant/mutator/registry.rb +55 -13
  91. data/lib/mutant/mutator/util.rb +2 -0
  92. data/lib/mutant/mutator/util/array.rb +3 -1
  93. data/lib/mutant/mutator/util/symbol.rb +2 -0
  94. data/lib/mutant/node_helpers.rb +10 -4
  95. data/lib/mutant/random.rb +2 -0
  96. data/lib/mutant/reporter.rb +2 -0
  97. data/lib/mutant/reporter/cli.rb +2 -0
  98. data/lib/mutant/reporter/cli/printer.rb +2 -0
  99. data/lib/mutant/reporter/cli/printer/config.rb +5 -2
  100. data/lib/mutant/reporter/cli/printer/killer.rb +2 -0
  101. data/lib/mutant/reporter/cli/printer/mutation.rb +13 -6
  102. data/lib/mutant/reporter/cli/printer/subject.rb +5 -1
  103. data/lib/mutant/reporter/null.rb +2 -0
  104. data/lib/mutant/runner.rb +2 -0
  105. data/lib/mutant/runner/config.rb +2 -0
  106. data/lib/mutant/runner/mutation.rb +2 -0
  107. data/lib/mutant/runner/subject.rb +2 -0
  108. data/lib/mutant/singleton_methods.rb +5 -3
  109. data/lib/mutant/strategy.rb +2 -0
  110. data/lib/mutant/strategy/method_expansion.rb +2 -0
  111. data/lib/mutant/strategy/rspec.rb +2 -0
  112. data/lib/mutant/strategy/rspec/dm2.rb +2 -0
  113. data/lib/mutant/strategy/rspec/dm2/lookup.rb +4 -2
  114. data/lib/mutant/strategy/rspec/dm2/lookup/method.rb +2 -0
  115. data/lib/mutant/strategy/static.rb +2 -0
  116. data/lib/mutant/subject.rb +4 -1
  117. data/lib/mutant/subject/method.rb +2 -0
  118. data/lib/mutant/subject/method/instance.rb +2 -0
  119. data/lib/mutant/subject/method/singleton.rb +2 -0
  120. data/lib/mutant/support/method_object.rb +2 -0
  121. data/lib/mutant/zombifier.rb +10 -6
  122. data/mutant.gemspec +11 -10
  123. data/spec/integration/mutant/rspec_killer_spec.rb +9 -4
  124. data/spec/integration/mutant/test_mutator_handles_types_spec.rb +3 -1
  125. data/spec/integration/mutant/zombie_spec.rb +2 -0
  126. data/spec/shared/method_matcher_behavior.rb +2 -0
  127. data/spec/shared/mutator_behavior.rb +16 -7
  128. data/spec/spec_helper.rb +26 -5
  129. data/spec/support/compress_helper.rb +5 -5
  130. data/spec/support/ice_nine_config.rb +2 -0
  131. data/spec/support/rspec.rb +2 -0
  132. data/spec/support/test_app.rb +2 -0
  133. data/spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb +2 -0
  134. data/spec/unit/mutant/cli/class_methods/new_spec.rb +17 -8
  135. data/spec/unit/mutant/cli/class_methods/run_spec.rb +10 -2
  136. data/spec/unit/mutant/cli/classifier/class_methods/build_spec.rb +4 -1
  137. data/spec/unit/mutant/cli/classifier/method/each_spec.rb +89 -0
  138. data/spec/unit/mutant/cli/classifier/namespace/flat/each_spec.rb +58 -0
  139. data/spec/unit/mutant/cli/classifier/namespace/recursive/each_spec.rb +58 -0
  140. data/spec/unit/mutant/cli/classifier/scope/each_spec.rb +33 -0
  141. data/spec/unit/mutant/context/root_spec.rb +5 -1
  142. data/spec/unit/mutant/context/scope/root_spec.rb +2 -0
  143. data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +2 -0
  144. data/spec/unit/mutant/differ/class_methods/build_spec.rb +2 -0
  145. data/spec/unit/mutant/differ/class_methods/colorize_line_spec.rb +2 -0
  146. data/spec/unit/mutant/differ/diff_spec.rb +67 -5
  147. data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +21 -4
  148. data/spec/unit/mutant/killer/success_predicate_spec.rb +2 -0
  149. data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +12 -5
  150. data/spec/unit/mutant/matcher/chain/each_spec.rb +2 -0
  151. data/spec/unit/mutant/matcher/chain/matchers_spec.rb +2 -0
  152. data/spec/unit/mutant/matcher/each_spec.rb +8 -1
  153. data/spec/unit/mutant/matcher/method/instance/class_methods/build_spec.rb +4 -2
  154. data/spec/unit/mutant/matcher/method/instance/each_spec.rb +21 -20
  155. data/spec/unit/mutant/matcher/method/singleton/each_spec.rb +22 -19
  156. data/spec/unit/mutant/matcher/methods/instance/each_spec.rb +8 -3
  157. data/spec/unit/mutant/matcher/methods/singleton/each_spec.rb +8 -3
  158. data/spec/unit/mutant/matcher/namespace/each_spec.rb +8 -2
  159. data/spec/unit/mutant/mutator/each_spec.rb +2 -0
  160. data/spec/unit/mutant/mutator/emit_new_spec.rb +10 -3
  161. data/spec/unit/mutant/mutator/emit_spec.rb +4 -2
  162. data/spec/unit/mutant/mutator/node/and_asgn/mutation_spec.rb +26 -0
  163. data/spec/unit/mutant/mutator/node/begin/mutation_spec.rb +2 -0
  164. data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +4 -2
  165. data/spec/unit/mutant/mutator/node/block_pass/mutation_spec.rb +14 -0
  166. data/spec/unit/mutant/mutator/node/break/mutation_spec.rb +15 -0
  167. data/spec/unit/mutant/mutator/node/case/mutation_spec.rb +2 -0
  168. data/spec/unit/mutant/mutator/node/cbase/mutation_spec.rb +3 -6
  169. data/spec/unit/mutant/mutator/node/connective/binary/mutation_spec.rb +2 -0
  170. data/spec/unit/mutant/mutator/node/const/mutation_spec.rb +3 -6
  171. data/spec/unit/mutant/mutator/node/define/mutation_spec.rb +2 -1
  172. data/spec/unit/mutant/mutator/node/defined_predicate/mutation_spec.rb +10 -0
  173. data/spec/unit/mutant/mutator/node/dstr/mutation_spec.rb +21 -0
  174. data/spec/unit/mutant/mutator/node/dsym/mutation_spec.rb +21 -0
  175. data/spec/unit/mutant/mutator/node/ensure/mutation_spec.rb +15 -0
  176. data/spec/unit/mutant/mutator/node/if/mutation_spec.rb +2 -1
  177. data/spec/unit/mutant/mutator/node/literal/array_spec.rb +2 -0
  178. data/spec/unit/mutant/mutator/node/literal/boolean/mutation_spec.rb +2 -0
  179. data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +2 -0
  180. data/spec/unit/mutant/mutator/node/literal/float_spec.rb +4 -2
  181. data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +2 -0
  182. data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +4 -5
  183. data/spec/unit/mutant/mutator/node/literal/range_spec.rb +8 -8
  184. data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +2 -0
  185. data/spec/unit/mutant/mutator/node/literal/string_spec.rb +2 -0
  186. data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +2 -0
  187. data/spec/unit/mutant/mutator/node/masgn/mutation_spec.rb +4 -10
  188. data/spec/unit/mutant/mutator/node/match_current_line/mutation_spec.rb +20 -0
  189. data/spec/unit/mutant/mutator/node/named_value/access/mutation_spec.rb +3 -2
  190. data/spec/unit/mutant/mutator/node/named_value/constant_assignment/mutation_spec.rb +3 -2
  191. data/spec/unit/mutant/mutator/node/named_value/variable_assignment/mutation_spec.rb +3 -2
  192. data/spec/unit/mutant/mutator/node/next/mutation_spec.rb +15 -0
  193. data/spec/unit/mutant/mutator/node/op_assgn/mutation_spec.rb +26 -0
  194. data/spec/unit/mutant/mutator/node/or_asgn/mutation_spec.rb +26 -0
  195. data/spec/unit/mutant/mutator/node/redo/mutation_spec.rb +10 -0
  196. data/spec/unit/mutant/mutator/node/rescue/mutation_spec.rb +24 -0
  197. data/spec/unit/mutant/mutator/node/restarg/mutation_spec.rb +16 -0
  198. data/spec/unit/mutant/mutator/node/return/mutation_spec.rb +2 -0
  199. data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +3 -1
  200. data/spec/unit/mutant/mutator/node/super/mutation_spec.rb +2 -0
  201. data/spec/unit/mutant/mutator/node/while/mutation_spec.rb +3 -1
  202. data/spec/unit/mutant/mutator/node/yield/mutation_spec.rb +15 -0
  203. data/spec/unit/mutant/node_helpers/n_not_spec.rb +2 -0
  204. data/spec/unit/mutant/runner/config/subjects_spec.rb +6 -2
  205. data/spec/unit/mutant/runner/config/success_predicate_spec.rb +15 -6
  206. data/spec/unit/mutant/runner/mutation/killer_spec.rb +3 -1
  207. data/spec/unit/mutant/runner/subject/success_predicate_spec.rb +15 -8
  208. data/spec/unit/mutant/strategy/method_expansion/class_methods/run_spec.rb +2 -0
  209. data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/instance/spec_files_spec.rb +32 -11
  210. data/spec/unit/mutant/strategy/rspec/dm2/lookup/method/singleton/spec_files_spec.rb +31 -11
  211. data/spec/unit/mutant/subject/context_spec.rb +2 -0
  212. data/spec/unit/mutant/subject/mutations_spec.rb +2 -0
  213. data/spec/unit/mutant/subject/node_spec.rb +2 -0
  214. data/test_app/lib/test_app.rb +2 -0
  215. data/test_app/lib/test_app/literal.rb +2 -0
  216. data/test_app/spec/shared/method_filter_parse_behavior.rb +5 -1
  217. data/test_app/spec/shared/method_match_behavior.rb +2 -0
  218. data/test_app/spec/spec_helper.rb +3 -1
  219. data/test_app/spec/unit/test_app/literal/command_spec.rb +2 -0
  220. data/test_app/spec/unit/test_app/literal/string_spec.rb +3 -1
  221. metadata +66 -18
  222. data/bin/zombie +0 -18
  223. data/test_app/spec/shared/mutator_behavior.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 226c5aebcbb82e525556434b669aadde2eda433d
4
- data.tar.gz: edf27540f7fdbad5176ed5b2c5e464e98fb06242
3
+ metadata.gz: 22c3af1fd28ad61a9e6968e66e5208272a9508cd
4
+ data.tar.gz: f8ac63722e87ff6c4899d3ba3e2d75ee6e76579c
5
5
  SHA512:
6
- metadata.gz: 5e98fbc5850bc2b1de41d76484dbdd0f8755a625bad6f1830b9cd27e42cb3fafebdbdb6f779175deb7a57e86901ac0677be34a55679342f05c0d5f05e528960c
7
- data.tar.gz: 2cc30f257f34cd3e113a5fa39e183a0abf0cfbc5c40efe10feba21b6b761756498abbc16a99e5356fd407b950bf9f7c1b6cc73b5b44192b7fb18bb1d05b417e9
6
+ metadata.gz: 636bfb2b5e7bd64d40ef70427c739484cf1db6b1eb3cf17c02b5846cc566e882174ade582b04973034b0f795b6e01a56e169a910283af54cd1d0a7096e1d5d9e
7
+ data.tar.gz: 035c70cca872d8a52c9a012e0d18a4e9027495860659d9d2d93c783542fe8fe38b646eca9e489db7029ac751fecbfc01dc18e438d3c797b871be3c645e646ec3
data/.gitignore CHANGED
@@ -1,7 +1,38 @@
1
- /.rbx
2
- /Gemfile.lock
3
- /tmp
4
- /coverage
5
- /test_app/.rbx
6
- /.bundle
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.sw[op]
15
+
16
+ ## Rubinius
17
+ *.rbc
18
+ .rbx
19
+
20
+ ## PROJECT::GENERAL
21
+ *.gem
22
+ coverage
23
+ profiling
24
+ turbulence
25
+ rdoc
26
+ pkg
27
+ tmp
28
+ doc
29
+ log
30
+ .yardoc
31
+ measurements
32
+
33
+ ## BUNDLER
34
+ .bundle
35
+ Gemfile.lock
36
+
37
+ ## PROJECT::SPECIFIC
7
38
  /vendor
data/.rspec CHANGED
@@ -1,3 +1,5 @@
1
1
  --color
2
2
  --format progress
3
+ --profile
4
+ --warnings
3
5
  --order random
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ mutant
data/.travis.yml CHANGED
@@ -1,20 +1,26 @@
1
1
  language: ruby
2
- script: 'bundle exec rake ci'
2
+ before_install: gem install bundler
3
+ bundler_args: --without yard guard benchmarks
4
+ script: "bundle exec rake ci"
3
5
  rvm:
4
6
  - 1.9.3
5
7
  - 2.0.0
6
8
  - ruby-head
7
9
  - rbx-19mode
8
- - ruby-head
9
- - jruby-19mode
10
10
  matrix:
11
+ include:
12
+ - rvm: jruby-19mode
13
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
14
+ - rvm: jruby-head
15
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug"
11
16
  allow_failures:
12
- - rvm: jruby-19mode # No fork(2) support, workaround planned
13
- - rvm: ruby-head # Broken at this time, bundler issue on travis
14
- - rvm: rbx-19mode # Broken at this time, yard/yardstick issue
17
+ - rvm: ruby-head # Broken at this time, rvm issue on travis
18
+ - rvm: rbx-19mode # Broken at this time, yard/yardstick issue
19
+ - rvm: jruby-19mode # No fork(2) support, workaround planned
20
+ - rvm: jruby-head # No fork(2) support, workaround planned
15
21
  notifications:
16
22
  irc:
17
23
  channels:
18
- - irc.freenode.org#rom-rb
24
+ - irc.freenode.org#mutant
19
25
  on_success: never
20
26
  on_failure: change
data/Gemfile CHANGED
@@ -1,8 +1,13 @@
1
+ # encoding: utf-8
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
- gem 'mutant', :path => '.'
7
+ gem 'mutant', path: '.'
8
+
9
+ group :development, :test do
10
+ gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
11
+ end
6
12
 
7
- gem 'devtools', :git => 'https://github.com/rom-rb/devtools.git'
8
- eval(File.read(File.join(File.dirname(__FILE__),'Gemfile.devtools')))
13
+ eval_gemfile File.join(File.dirname(__FILE__), 'Gemfile.devtools')
data/Gemfile.devtools CHANGED
@@ -3,7 +3,7 @@
3
3
  group :development do
4
4
  gem 'rake', '~> 10.1.0'
5
5
  gem 'rspec', '~> 2.14.1'
6
- gem 'yard', '~> 0.8.6.2'
6
+ gem 'yard', '~> 0.8.7'
7
7
  end
8
8
 
9
9
  group :yard do
@@ -31,7 +31,7 @@ end
31
31
 
32
32
  group :metrics do
33
33
  gem 'coveralls', '~> 0.6.7'
34
- gem 'flay', '~> 2.3.1'
34
+ gem 'flay', '~> 2.4.0'
35
35
  gem 'flog', '~> 4.1.1'
36
36
  gem 'reek', '~> 1.3.1', git: 'https://github.com/troessner/reek.git'
37
37
  gem 'rubocop', '~> 0.10.0', git: 'https://github.com/bbatsov/rubocop.git'
@@ -41,10 +41,6 @@ group :metrics do
41
41
  platforms :ruby_19, :ruby_20 do
42
42
  gem 'yard-spellcheck', '~> 0.1.5'
43
43
  end
44
-
45
- platforms :rbx do
46
- gem 'pelusa', '~> 0.2.2'
47
- end
48
44
  end
49
45
 
50
46
  group :benchmarks do
data/Guardfile CHANGED
@@ -2,17 +2,31 @@
2
2
 
3
3
  guard :bundler do
4
4
  watch('Gemfile')
5
+ watch('Gemfile.lock')
6
+ watch(%w{.+.gemspec\z})
5
7
  end
6
8
 
7
- guard :rspec, :cli => '--fail-fast', :all_on_start => false, :all_after_pass => 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' }
9
+ guard :rspec, cli: File.read('.rspec').split.push('--fail-fast').join(' '), keep_failed: false do
10
+ # Run all specs if configuration is modified
11
+ watch('.rspec') { 'spec' }
12
+ watch('Guardfile') { 'spec' }
13
+ watch('Gemfile.lock') { 'spec' }
14
+ watch('spec/spec_helper.rb') { 'spec' }
11
15
 
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' }
16
+ # Run all specs if supporting files files are modified
17
+ watch(%r{\Aspec/(?:fixtures|lib|support|shared)/.+\.rb\z}) { 'spec' }
15
18
 
16
- # run a spec if it is modified
19
+ # Run unit specs if associated lib code is modified
20
+ watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}*"] }
21
+ watch(%r{\Alib/(.+)/support/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}/#{m[2]}*"] }
22
+ watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' }
23
+
24
+ # Run a spec if it is modified
17
25
  watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
18
26
  end
27
+
28
+ guard :rubocop, cli: %w[--config config/rubocop.yml] do
29
+ watch(%r{.+\.(?:rb|rake)\z})
30
+ watch(%r{\Aconfig/rubocop\.yml\z}) { |m| File.dirname(m[0]) }
31
+ watch(%r{(?:.+/)?\.rubocop\.yml\z}) { |m| File.dirname(m[0]) }
32
+ end
data/README.md CHANGED
@@ -35,6 +35,7 @@ The following projects adopted mutant, and aim 100% mutation coverage:
35
35
  * [virtus](https://github.com/solnic/virtus)
36
36
  * [quacky](https://github.com/benmoss/quacky)
37
37
  * [substation](https://github.com/snusnu/substation)
38
+ * [large_binomials](https://github.com/filipvanlaenen/large_binomials)
38
39
  * various small/minor stuff under https://github.com/mbj
39
40
 
40
41
  Feel free to ping me to add your project to the list!
@@ -155,7 +156,8 @@ Your options:
155
156
 
156
157
  * GitHub Issues https://github.com/mbj/mutant/issues
157
158
  * Ping me on https://twitter.com/_m_b_j_
158
- * #rom-rb channel on freenode, I hang around on CET daytimes. (nick mbj)
159
+ * #mutant channel on freenode, I hang around on CET daytimes. (nick mbj)
160
+ You'll also find others [ROM](https://github.com/rom-rb) team members here that can answer questions.
159
161
 
160
162
  Credits
161
163
  -------
data/Rakefile CHANGED
@@ -1,4 +1,7 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'devtools'
4
+
2
5
  Devtools.init_rake_tasks
3
6
 
4
7
  Rake.application.load_imports
data/bin/mutant CHANGED
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
+ # encoding: utf-8
2
3
 
3
4
  trap('INT') do |status|
4
- exit! 128+status
5
+ exit! 128 + status
5
6
  end
6
7
 
7
8
  require 'mutant'
8
9
 
9
10
  namespace =
10
- if File.basename($0) == 'zombie'
11
- $stderr.puts('Detected zombie environment...')
11
+ if ARGV.include?('--zombie')
12
+ $stderr.puts('Running mutant zombified!')
12
13
  Mutant::Zombifier.zombify
13
14
  Zombie::Mutant
14
15
  else
data/config/devtools.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  ---
2
- unit_test_timeout: 1.0
2
+ unit_test_timeout: 5.0
data/config/flay.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 16
3
- total_score: 737
3
+ total_score: 764
data/config/flog.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  ---
2
- threshold: 19.8
2
+ threshold: 20.5
data/config/reek.yml CHANGED
@@ -24,9 +24,9 @@ DuplicateMethodCall:
24
24
  FeatureEnvy:
25
25
  enabled: true
26
26
  exclude:
27
- - Mutant::Matcher::Method::Singleton#receiver?
28
- - Mutant::Matcher::Method::Instance#match?
29
27
  - Mutant::CLI#parse
28
+ - Mutant::Matcher::Method::Instance#match?
29
+ - Mutant::Matcher::Method::Singleton#receiver?
30
30
  - Mutant::Mutation::Evil#success?
31
31
  - Mutant::Mutation::Neutral#success?
32
32
  - Mutant::Reporter::CLI#subject_results
@@ -46,9 +46,9 @@ NestedIterators:
46
46
  enabled: true
47
47
  exclude:
48
48
  - Mutant#self.singleton_subclass_instance
49
+ - Mutant::CLI#parse
49
50
  - Mutant::Mutator::Util::Array::Element#dispatch
50
51
  - Mutant::Reporter::CLI::Printer::Config::Runner#generic_stats
51
- - Mutant::CLI#parse
52
52
  max_allowed_nesting: 1
53
53
  ignore_iterators: []
54
54
  NilCheck:
@@ -76,12 +76,13 @@ TooManyMethods:
76
76
  TooManyStatements:
77
77
  enabled: true
78
78
  exclude:
79
+ - Mutant#self.singleton_subclass_instance
79
80
  - Mutant::CLI#parse
81
+ - Mutant::Killer::Rspec#run
80
82
  - Mutant::Reporter::CLI#colorized_diff
81
83
  - Mutant::Reporter::CLI::Printer::Config::Runner#run
82
- - Mutant#self.singleton_subclass_instance
83
- - Mutant::Zombifier::File#self.find_uncached
84
84
  - Mutant::Runner#dispatch
85
+ - Mutant::Zombifier::File#self.find_uncached
85
86
  max_statements: 6
86
87
  UncommunicativeMethodName:
87
88
  enabled: true
@@ -123,8 +124,8 @@ UnusedParameters:
123
124
  UtilityFunction:
124
125
  enabled: true
125
126
  exclude:
126
- - Mutant::NodeHelpers#s
127
127
  - Mutant::CLI#reporter
128
128
  - Mutant::Mutation::Evil#success?
129
129
  - Mutant::Mutation::Neutral#success?
130
+ - Mutant::NodeHelpers#s
130
131
  max_helper_calls: 0
data/config/rubocop.yml CHANGED
@@ -3,6 +3,7 @@ AllCops:
3
3
  - '../**/*.rake'
4
4
  - 'Gemfile'
5
5
  - 'Gemfile.devtools'
6
+ - 'mutant.gemspec'
6
7
  Excludes:
7
8
  - '**/vendor/**'
8
9
  - '**/benchmarks/**'
@@ -32,3 +33,57 @@ CollectionMethods:
32
33
  # to scan the code and see where the sections are.
33
34
  AccessControl:
34
35
  Enabled: false
36
+
37
+ MethodLength:
38
+ CountComments: false
39
+ Max: 17 # TODO: Bring down to 10
40
+
41
+ RegexpLiteral: # I do not agree %r(\A) is more readable than /\A/
42
+ Enabled: false
43
+
44
+ Eval:
45
+ Enabled: false # Mutant must use Kernel#eval to inject mutated source
46
+
47
+ # Limit line length
48
+ LineLength:
49
+ Max: 124 # TODO: lower to 79
50
+
51
+ # Disable documentation checking until a class needs to be documented once
52
+ Documentation:
53
+ Enabled: false
54
+
55
+ # Do not favor modifier if/unless usage when you have a single-line body
56
+ IfUnlessModifier:
57
+ Enabled: false
58
+
59
+ # Mutant needs to define methods like def bar; end in specs
60
+ Semicolon:
61
+ Enabled: false
62
+
63
+ # Mutant needs to define multiple methods on same line in specs
64
+ EmptyLineBetweenDefs:
65
+ Enabled: false
66
+
67
+ # Mutant needs to define singleton methods like Foo.bar in specs
68
+ ClassMethods:
69
+ Enabled: false
70
+
71
+ # Allow case equality operator (in limited use within the specs)
72
+ CaseEquality:
73
+ Enabled: false
74
+
75
+ # Constants do not always have to use SCREAMING_SNAKE_CASE
76
+ ConstantName:
77
+ Enabled: false
78
+
79
+ # Not all trivial readers/writers can be defined with attr_* methods
80
+ TrivialAccessors:
81
+ Enabled: false
82
+
83
+ # I like 1.8 syntax:
84
+ HashSyntax:
85
+ Enabled: false
86
+
87
+ # And also have a differend opinion here
88
+ AndOr:
89
+ Enabled: false
data/lib/mutant.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'benchmark'
2
4
  require 'set'
3
5
  require 'adamantium'
@@ -57,12 +59,12 @@ require 'mutant/mutator/node/literal/nil'
57
59
  require 'mutant/mutator/node/argument'
58
60
  require 'mutant/mutator/node/arguments'
59
61
  require 'mutant/mutator/node/begin'
60
- require 'mutant/mutator/node/cbase'
61
62
  require 'mutant/mutator/node/connective/binary'
62
63
  require 'mutant/mutator/node/const'
63
64
  require 'mutant/mutator/node/named_value/access'
64
65
  require 'mutant/mutator/node/named_value/constant_assignment'
65
66
  require 'mutant/mutator/node/named_value/variable_assignment'
67
+ require 'mutant/mutator/node/noop'
66
68
  require 'mutant/mutator/node/while'
67
69
  require 'mutant/mutator/node/super'
68
70
  require 'mutant/mutator/node/zsuper'
data/lib/mutant/cache.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  module Mutant
2
4
  # An AST cache
3
5
  class Cache
data/lib/mutant/cli.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'optparse'
2
4
 
3
5
  module Mutant
@@ -38,7 +40,7 @@ module Mutant
38
40
  #
39
41
  # @api private
40
42
  #
41
- def initialize(arguments=[])
43
+ def initialize(arguments = [])
42
44
  @filters, @matchers = [], []
43
45
 
44
46
  @cache = Mutant::Cache.new
@@ -148,7 +150,7 @@ module Mutant
148
150
  #
149
151
  # @api private
150
152
  #
151
- def add_filter(klass,filter)
153
+ def add_filter(klass, filter)
152
154
  @filters << klass.new(filter)
153
155
  end
154
156
 
@@ -197,13 +199,15 @@ module Mutant
197
199
  # @api private
198
200
  #
199
201
  def parse(arguments)
200
- opts = OptionParser.new do |opts|
201
- opts.banner = 'usage: mutant STRATEGY [options] MATCHERS ...'
202
- opts.separator ''
203
- opts.separator 'Strategies:'
202
+ opts = OptionParser.new do |builder|
203
+ builder.banner = 'usage: mutant STRATEGY [options] MATCHERS ...'
204
+ builder.separator ''
205
+ builder.separator 'Strategies:'
206
+
207
+ builder.on('--zombie', 'Run mutant zombified')
204
208
 
205
- add_strategies(opts)
206
- add_options(opts)
209
+ add_strategies(builder)
210
+ add_options(builder)
207
211
  end
208
212
 
209
213
  matchers =
@@ -244,7 +248,7 @@ module Mutant
244
248
  set_strategy Strategy::Rspec::Unit
245
249
  end.on('--rspec-full', 'executes all specs under ./spec') do
246
250
  set_strategy Strategy::Rspec::Full
247
- end.on('--rspec-dm2', 'executes spec/unit/namespace/class/method_spec.rb') do
251
+ end.on('--rspec-dm2', 'executes spec/unit/$nesting/$method_spec.rb') do
248
252
  set_strategy Strategy::Rspec::DM2
249
253
  end
250
254
  end
@@ -265,7 +269,7 @@ module Mutant
265
269
  add_filter Mutation::Filter::Code, filter
266
270
  end.on('--fail-fast', 'Fail fast') do
267
271
  set_fail_fast
268
- end.on('-d','--debug', 'Enable debugging output') do
272
+ end.on('-d', '--debug', 'Enable debugging output') do
269
273
  set_debug
270
274
  end.on_tail('-h', '--help', 'Show this message') do
271
275
  puts opts