mutant 0.8.24 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +3 -3
  3. data/Changelog.md +14 -654
  4. data/Gemfile +13 -0
  5. data/Gemfile.lock +59 -64
  6. data/LICENSE +271 -20
  7. data/README.md +73 -140
  8. data/Rakefile +0 -21
  9. data/bin/mutant +7 -2
  10. data/config/reek.yml +2 -1
  11. data/config/rubocop.yml +5 -9
  12. data/docs/incremental.md +76 -0
  13. data/docs/known-problems.md +0 -14
  14. data/docs/mutant-minitest.md +1 -1
  15. data/docs/mutant-rspec.md +2 -24
  16. data/lib/mutant.rb +45 -53
  17. data/lib/mutant/ast/nodes.rb +0 -2
  18. data/lib/mutant/ast/types.rb +1 -117
  19. data/lib/mutant/base.rb +192 -0
  20. data/lib/mutant/bootstrap.rb +145 -0
  21. data/lib/mutant/cli.rb +68 -54
  22. data/lib/mutant/config.rb +119 -6
  23. data/lib/mutant/env.rb +94 -8
  24. data/lib/mutant/expression.rb +6 -1
  25. data/lib/mutant/expression/parser.rb +9 -31
  26. data/lib/mutant/integration.rb +64 -36
  27. data/lib/mutant/isolation.rb +16 -1
  28. data/lib/mutant/isolation/fork.rb +105 -40
  29. data/lib/mutant/license.rb +34 -0
  30. data/lib/mutant/license/subscription.rb +47 -0
  31. data/lib/mutant/license/subscription/commercial.rb +57 -0
  32. data/lib/mutant/license/subscription/opensource.rb +77 -0
  33. data/lib/mutant/loader.rb +27 -4
  34. data/lib/mutant/matcher.rb +48 -1
  35. data/lib/mutant/matcher/chain.rb +1 -1
  36. data/lib/mutant/matcher/config.rb +0 -2
  37. data/lib/mutant/matcher/filter.rb +1 -1
  38. data/lib/mutant/matcher/method.rb +11 -7
  39. data/lib/mutant/matcher/methods.rb +1 -1
  40. data/lib/mutant/matcher/namespace.rb +1 -1
  41. data/lib/mutant/matcher/null.rb +1 -1
  42. data/lib/mutant/matcher/scope.rb +1 -1
  43. data/lib/mutant/meta/example/dsl.rb +0 -8
  44. data/lib/mutant/mutation.rb +1 -2
  45. data/lib/mutant/mutator/node.rb +2 -9
  46. data/lib/mutant/mutator/node/arguments.rb +1 -1
  47. data/lib/mutant/mutator/node/class.rb +0 -8
  48. data/lib/mutant/mutator/node/define.rb +0 -12
  49. data/lib/mutant/mutator/node/generic.rb +30 -44
  50. data/lib/mutant/mutator/node/index.rb +4 -4
  51. data/lib/mutant/mutator/node/literal/regex.rb +0 -39
  52. data/lib/mutant/mutator/node/send.rb +13 -12
  53. data/lib/mutant/parallel.rb +61 -40
  54. data/lib/mutant/parallel/driver.rb +59 -0
  55. data/lib/mutant/parallel/source.rb +6 -2
  56. data/lib/mutant/parallel/worker.rb +63 -45
  57. data/lib/mutant/range.rb +15 -0
  58. data/lib/mutant/reporter/cli.rb +5 -11
  59. data/lib/mutant/reporter/cli/format.rb +3 -46
  60. data/lib/mutant/reporter/cli/printer/config.rb +5 -6
  61. data/lib/mutant/reporter/cli/printer/env.rb +40 -0
  62. data/lib/mutant/reporter/cli/printer/env_progress.rb +13 -17
  63. data/lib/mutant/reporter/cli/printer/isolation_result.rb +17 -3
  64. data/lib/mutant/reporter/cli/printer/mutation_result.rb +2 -3
  65. data/lib/mutant/reporter/cli/printer/status_progressive.rb +19 -10
  66. data/lib/mutant/repository.rb +0 -65
  67. data/lib/mutant/repository/diff.rb +104 -0
  68. data/lib/mutant/repository/diff/ranges.rb +52 -0
  69. data/lib/mutant/result.rb +16 -7
  70. data/lib/mutant/runner.rb +38 -47
  71. data/lib/mutant/runner/sink.rb +1 -1
  72. data/lib/mutant/selector/null.rb +19 -0
  73. data/lib/mutant/subject.rb +3 -1
  74. data/lib/mutant/subject/method/instance.rb +3 -1
  75. data/lib/mutant/transform.rb +511 -0
  76. data/lib/mutant/variable.rb +282 -0
  77. data/lib/mutant/version.rb +1 -1
  78. data/lib/mutant/warnings.rb +113 -0
  79. data/meta/case.rb +1 -0
  80. data/meta/class.rb +0 -9
  81. data/meta/def.rb +1 -26
  82. data/meta/regexp.rb +10 -20
  83. data/meta/send.rb +14 -46
  84. data/mutant-minitest.gemspec +1 -1
  85. data/mutant-rspec.gemspec +2 -2
  86. data/mutant.gemspec +15 -16
  87. data/mutant.yml +6 -0
  88. data/spec/integration/mutant/isolation/fork_spec.rb +22 -5
  89. data/spec/integration/mutant/minitest_spec.rb +3 -2
  90. data/spec/integration/mutant/rspec_spec.rb +4 -3
  91. data/spec/integrations.yml +16 -13
  92. data/spec/shared/base_behavior.rb +45 -0
  93. data/spec/shared/framework_integration_behavior.rb +43 -14
  94. data/spec/spec_helper.rb +21 -17
  95. data/spec/support/corpus.rb +56 -95
  96. data/spec/support/shared_context.rb +37 -14
  97. data/spec/support/xspec.rb +7 -3
  98. data/spec/unit/mutant/bootstrap_spec.rb +216 -0
  99. data/spec/unit/mutant/cli_spec.rb +173 -117
  100. data/spec/unit/mutant/config_spec.rb +126 -0
  101. data/spec/unit/mutant/either_spec.rb +247 -0
  102. data/spec/unit/mutant/env_spec.rb +162 -40
  103. data/spec/unit/mutant/expression/method_spec.rb +16 -0
  104. data/spec/unit/mutant/expression/parser_spec.rb +29 -33
  105. data/spec/unit/mutant/expression_spec.rb +5 -7
  106. data/spec/unit/mutant/integration_spec.rb +100 -9
  107. data/spec/unit/mutant/isolation/fork_spec.rb +125 -67
  108. data/spec/unit/mutant/isolation/result_spec.rb +33 -1
  109. data/spec/unit/mutant/license_spec.rb +257 -0
  110. data/spec/unit/mutant/loader_spec.rb +50 -11
  111. data/spec/unit/mutant/matcher/compiler_spec.rb +0 -78
  112. data/spec/unit/mutant/matcher/method/instance_spec.rb +55 -11
  113. data/spec/unit/mutant/matcher/method/singleton_spec.rb +12 -2
  114. data/spec/unit/mutant/matcher_spec.rb +102 -0
  115. data/spec/unit/mutant/maybe_spec.rb +60 -0
  116. data/spec/unit/mutant/meta/example/dsl_spec.rb +1 -17
  117. data/spec/unit/mutant/mutation_spec.rb +13 -6
  118. data/spec/unit/mutant/parallel/driver_spec.rb +112 -14
  119. data/spec/unit/mutant/parallel/source/array_spec.rb +25 -17
  120. data/spec/unit/mutant/parallel/worker_spec.rb +182 -44
  121. data/spec/unit/mutant/parallel_spec.rb +105 -8
  122. data/spec/unit/mutant/range_spec.rb +141 -0
  123. data/spec/unit/mutant/reporter/cli/printer/config_spec.rb +7 -21
  124. data/spec/unit/mutant/reporter/cli/printer/env_progress_spec.rb +15 -6
  125. data/spec/unit/mutant/reporter/cli/printer/env_result_spec.rb +10 -2
  126. data/spec/unit/mutant/reporter/cli/printer/isolation_result_spec.rb +12 -4
  127. data/spec/unit/mutant/reporter/cli/printer/mutation_result_spec.rb +31 -2
  128. data/spec/unit/mutant/reporter/cli/printer/status_progressive_spec.rb +4 -4
  129. data/spec/unit/mutant/reporter/cli/printer/subject_result_spec.rb +5 -0
  130. data/spec/unit/mutant/reporter/cli_spec.rb +46 -123
  131. data/spec/unit/mutant/repository/diff/ranges_spec.rb +180 -0
  132. data/spec/unit/mutant/repository/diff_spec.rb +84 -71
  133. data/spec/unit/mutant/require_highjack_spec.rb +1 -1
  134. data/spec/unit/mutant/result/env_spec.rb +39 -9
  135. data/spec/unit/mutant/result/test_spec.rb +14 -0
  136. data/spec/unit/mutant/runner_spec.rb +88 -41
  137. data/spec/unit/mutant/selector/expression_spec.rb +11 -10
  138. data/spec/unit/mutant/selector/null_spec.rb +17 -0
  139. data/spec/unit/mutant/subject/method/instance_spec.rb +44 -5
  140. data/spec/unit/mutant/subject/method/singleton_spec.rb +9 -2
  141. data/spec/unit/mutant/subject_spec.rb +9 -1
  142. data/spec/unit/mutant/transform/array_spec.rb +92 -0
  143. data/spec/unit/mutant/transform/bool_spec.rb +63 -0
  144. data/spec/unit/mutant/transform/error_spec.rb +132 -0
  145. data/spec/unit/mutant/transform/exception_spec.rb +44 -0
  146. data/spec/unit/mutant/transform/hash_spec.rb +236 -0
  147. data/spec/unit/mutant/transform/index_spec.rb +92 -0
  148. data/spec/unit/mutant/transform/named_spec.rb +49 -0
  149. data/spec/unit/mutant/transform/primitive_spec.rb +56 -0
  150. data/spec/unit/mutant/transform/sequence_spec.rb +98 -0
  151. data/spec/unit/mutant/variable_spec.rb +618 -0
  152. data/spec/unit/mutant/warnings_spec.rb +89 -0
  153. data/spec/unit/mutant/world_spec.rb +63 -0
  154. data/test_app/Gemfile.minitest +0 -2
  155. metadata +79 -113
  156. data/.gitattributes +0 -1
  157. data/.ruby-gemset +0 -1
  158. data/config/triage.yml +0 -2
  159. data/lib/mutant/actor.rb +0 -57
  160. data/lib/mutant/actor/env.rb +0 -31
  161. data/lib/mutant/actor/mailbox.rb +0 -34
  162. data/lib/mutant/actor/receiver.rb +0 -42
  163. data/lib/mutant/actor/sender.rb +0 -26
  164. data/lib/mutant/ast/meta/restarg.rb +0 -19
  165. data/lib/mutant/ast/regexp.rb +0 -42
  166. data/lib/mutant/ast/regexp/transformer.rb +0 -187
  167. data/lib/mutant/ast/regexp/transformer/direct.rb +0 -123
  168. data/lib/mutant/ast/regexp/transformer/named_group.rb +0 -59
  169. data/lib/mutant/ast/regexp/transformer/options_group.rb +0 -83
  170. data/lib/mutant/ast/regexp/transformer/quantifier.rb +0 -114
  171. data/lib/mutant/ast/regexp/transformer/recursive.rb +0 -58
  172. data/lib/mutant/ast/regexp/transformer/root.rb +0 -31
  173. data/lib/mutant/ast/regexp/transformer/text.rb +0 -60
  174. data/lib/mutant/env/bootstrap.rb +0 -160
  175. data/lib/mutant/matcher/compiler.rb +0 -60
  176. data/lib/mutant/mutator/node/regexp.rb +0 -35
  177. data/lib/mutant/mutator/node/regexp/alternation_meta.rb +0 -23
  178. data/lib/mutant/mutator/node/regexp/capture_group.rb +0 -28
  179. data/lib/mutant/mutator/node/regexp/character_type.rb +0 -32
  180. data/lib/mutant/mutator/node/regexp/end_of_line_anchor.rb +0 -23
  181. data/lib/mutant/mutator/node/regexp/end_of_string_or_before_end_of_line_anchor.rb +0 -23
  182. data/lib/mutant/mutator/node/regexp/greedy_zero_or_more.rb +0 -27
  183. data/lib/mutant/parallel/master.rb +0 -181
  184. data/lib/mutant/reporter/cli/printer/status.rb +0 -53
  185. data/lib/mutant/reporter/cli/tput.rb +0 -46
  186. data/lib/mutant/warning_filter.rb +0 -61
  187. data/meta/regexp/character_types.rb +0 -23
  188. data/meta/regexp/regexp_alternation_meta.rb +0 -13
  189. data/meta/regexp/regexp_bol_anchor.rb +0 -10
  190. data/meta/regexp/regexp_bos_anchor.rb +0 -18
  191. data/meta/regexp/regexp_capture_group.rb +0 -19
  192. data/meta/regexp/regexp_eol_anchor.rb +0 -10
  193. data/meta/regexp/regexp_eos_anchor.rb +0 -8
  194. data/meta/regexp/regexp_eos_ob_eol_anchor.rb +0 -10
  195. data/meta/regexp/regexp_greedy_zero_or_more.rb +0 -12
  196. data/meta/regexp/regexp_root_expression.rb +0 -10
  197. data/meta/restarg.rb +0 -10
  198. data/spec/support/fake_actor.rb +0 -111
  199. data/spec/support/warning.rb +0 -66
  200. data/spec/unit/mutant/actor/binding_spec.rb +0 -34
  201. data/spec/unit/mutant/actor/env_spec.rb +0 -31
  202. data/spec/unit/mutant/actor/mailbox_spec.rb +0 -28
  203. data/spec/unit/mutant/actor/message_spec.rb +0 -25
  204. data/spec/unit/mutant/actor/receiver_spec.rb +0 -58
  205. data/spec/unit/mutant/actor/sender_spec.rb +0 -24
  206. data/spec/unit/mutant/ast/regexp/parse_spec.rb +0 -19
  207. data/spec/unit/mutant/ast/regexp/transformer/lookup_table/table_spec.rb +0 -21
  208. data/spec/unit/mutant/ast/regexp/transformer/lookup_table_spec.rb +0 -35
  209. data/spec/unit/mutant/ast/regexp/transformer_spec.rb +0 -21
  210. data/spec/unit/mutant/ast/regexp_spec.rb +0 -704
  211. data/spec/unit/mutant/env/bootstrap_spec.rb +0 -188
  212. data/spec/unit/mutant/matcher/compiler/subject_prefix_spec.rb +0 -26
  213. data/spec/unit/mutant/parallel/master_spec.rb +0 -338
  214. data/spec/unit/mutant/reporter/cli/printer/status_spec.rb +0 -121
  215. data/spec/unit/mutant/reporter/cli/tput_spec.rb +0 -50
  216. data/spec/unit/mutant/warning_filter_spec.rb +0 -106
  217. data/spec/unit/mutant_spec.rb +0 -17
  218. data/test_app/Gemfile.rspec3.7 +0 -7
data/README.md CHANGED
@@ -2,8 +2,6 @@ mutant
2
2
  ======
3
3
 
4
4
  [![Build Status](https://circleci.com/gh/mbj/mutant.svg?style=shield&circle-token=1afd77e8f0f9d0a11fd8f15f5d7b10270f4665e2)](https://circleci.com/gh/mbj/mutant/tree/master)
5
- [![Code Climate](https://codeclimate.com/github/mbj/mutant.svg)](https://codeclimate.com/github/mbj/mutant)
6
- [![Inline docs](http://inch-ci.org/github/mbj/mutant.svg)](http://inch-ci.org/github/mbj/mutant)
7
5
  [![Gem Version](https://img.shields.io/gem/v/mutant.svg)](https://rubygems.org/gems/mutant)
8
6
  [![Slack Status](https://mutation-testing-slack.herokuapp.com/badge.svg)](https://mutation-testing.slack.com/messages/mutant)
9
7
 
@@ -14,7 +12,7 @@ Mutant is a mutation testing tool for Ruby. Mutation testing is a technique to v
14
12
  ## Why do I want it?
15
13
 
16
14
  Mutant adds to your toolbox: Detection of uncovered semantics in your code.
17
- Coverage becomes a meaninful metric!
15
+ Coverage becomes a meaningful metric!
18
16
 
19
17
  On each detection of uncovered semantics you have the opportunity to:
20
18
 
@@ -25,172 +23,107 @@ On each detection of uncovered semantics you have the opportunity to:
25
23
  ## How Do I use it?
26
24
 
27
25
  * Start with reading the [nomenclature](/docs/nomenclature.md) documentation.
28
- * Than select and setup your [integration](/docs/nomenclature.md#interation), also make sure
26
+ * Then select and setup your [integration](/docs/nomenclature.md#integration), also make sure
29
27
  you can reproduce the examples in the integration specific documentation.
30
- * Identify your preferred mutation testing strategy. Its recommended to start at the commit level,
28
+ * Identify your preferred mutation testing strategy. It is recommended to start at the commit level,
31
29
  to test only the code you had been touching. See the [incremental](#only-mutating-changed-code)
32
30
  mutation testing documentation.
33
31
 
34
- Mutant uses a pure Ruby [parser](https://github.com/whitequark/parser) and an [unparser](https://github.com/mbj/unparser)
35
- to do its magic.
32
+ ## Licensing
36
33
 
37
- Topics
38
- ------
34
+ Mutant was recently transitioned commercial software, with a free usage plan for opensource projects.
39
35
 
40
- * [Nomenclature](/docs/nomenclature.md)
41
- * [Reading Reports](/docs/reading-reports.md)
42
- * [Known Problems](/docs/known-problems.md)
43
- * [Limitations](/docs/limitations.md)
44
- * [Concurrency](/docs/concurrency.md)
45
- * [Rspec Integration](/docs/mutant-rspec.md)
46
- * [Minitest Integration](/docs/mutant-minitest.md)
36
+ Commercial projects have to acquire a license per developer, with unlimited repositories
37
+ per developer.
47
38
 
48
- Sponsoring
49
- ----------
39
+ Opensource projects have to acquire their free license per repository.
50
40
 
51
- Mutant, as published in the opensource version, would not exist without the help
52
- of [contributors](https://github.com/mbj/mutant/graphs/contributors) spending lots
53
- of their private time.
41
+ The license distribution happens through the `mutant-license` gem in mutants dependencies.
42
+ This gem is dynamically generated per licensee and comes with a unique license gem source
43
+ URL.
54
44
 
55
- Additionally, the following features where sponsored by organizations:
45
+ After signup for a license the following has to be added to your `Gemfile` replacing `${key}`
46
+ with the license key and `${plan}` with `com` for commercial or `oss` for opensource usage.
56
47
 
57
- * The `mutant-minitest` integration was sponsored by [Arkency](https://arkency.com/)
58
- * Mutant's initial concurrency support was sponsored by an undisclosed company that does
59
- currently not wish to be listed here.
60
-
61
- If your organization is interested in sponsoring a feature, general maintainership or bugfixes, contact
62
- [Markus Schirp](mailto:mbj@schirp-dso.com).
63
-
64
- Mutation-Operators
65
- ------------------
66
-
67
- Mutant supports a wide range of mutation operators. An exhaustive list can be found in the [mutant-meta](https://github.com/mbj/mutant/tree/master/meta).
68
- The `mutant-meta` is arranged to the AST-Node-Types of parser. Refer to parsers [AST documentation](https://github.com/whitequark/parser/blob/master/doc/AST_FORMAT.md) in doubt.
69
-
70
- There is no easy and universal way to count the number of mutation operators a tool supports.
71
-
72
- Neutral (noop) Tests
73
- --------------------
74
-
75
- Mutant will also test the original, unmutated, version your code. This ensures that mutant is able to properly setup and run your tests.
76
- If an error occurs while mutant/rspec is running testing the original code, you will receive an error like the following:
77
- ```
78
- --- Neutral failure ---
79
- Original code was inserted unmutated. And the test did NOT PASS.
80
- Your tests do not pass initially or you found a bug in mutant / unparser.
81
- ...
82
- Test Output:
83
- marshal data too short
48
+ ```ruby
49
+ source 'https://${plan}:${key}@gem.mutant.dev' do
50
+ gem 'mutant-license'
51
+ end
84
52
  ```
85
- Currently, troubleshooting these errors requires using a debugger and/or modyifying mutant to print out the error. You will want to rescue and inspect exceptions raised in this method: lib/mutant/integration/rspec.rb:call
86
-
87
- Only Mutating Changed Code
88
- --------------------------
89
53
 
90
- Running mutant for the first time on an existing codebase can be a rather disheartening experience due to the large number of alive mutations found! Mutant has a setting that can help. Using the `--since` argument, mutant will only mutate code that has been modified. This allows you to introduce mutant into an existing code base without drowning in errors. Example usage that will mutate all code changed between master and the current branch:
91
-
92
- ```
93
- bundle exec mutant --include lib --require virtus --since master --use rspec Virtus::Attribute#type
94
- ```
54
+ The mutant license gem contains metadata that allows mutant to verify licensed use.
95
55
 
96
- Note that this feature requires at least git `2.13.0`.
56
+ For commercial licenses mutant checks the git commit author or the configured git email
57
+ to be in the set of licensed developers.
97
58
 
98
- Presentations
99
- -------------
59
+ For opensource licenses mutant checks the git remotes against the license whitelist.
60
+ This allows the project maintainer to sign up and not bother collaborators with the details.
100
61
 
101
- There are some presentations about mutant in the wild:
62
+ There are, apart from initial license gem installation, no remote interactions for
63
+ license validation.
102
64
 
103
- * [RailsConf 2014](http://railsconf.com/) / http://confreaks.com/videos/3333-railsconf-mutation-testing-with-mutant
104
- * [Wrocloverb 2014](http://wrocloverb.com/) / https://www.youtube.com/watch?v=rz-lFKEioLk
105
- * [eurucamp 2013](http://2013.eurucamp.org/) / FrOSCon-2013 http://slid.es/markusschirp/mutation-testing
106
- * [Cologne.rb](http://www.colognerb.de/topics/mutation-testing-mit-mutant) / https://github.com/DonSchado/colognerb-on-mutant/blob/master/mutation_testing_slides.pdf
65
+ To inquire for license please contact [Markus Schirp](mailto:mbj@schirp-dso.com?subject=Mutant%20License).
107
66
 
108
- Planning a presentation?
109
- ------------------------
67
+ ### Pricing
110
68
 
111
- Mutation testing lately (not only mutant) seems to attract some attention. So naturally
112
- people do talks about it at conferences, user groups or other chances. Thanks for that!
69
+ Only relevant for commercial use.
113
70
 
114
- As I (the author @mbj) am not too happy with some of the facts being presented about
115
- mutant the last month.
71
+ Mutant offers a subscription model under a monthly plan.
72
+ Yearly prepayments with discounts are available.
116
73
 
117
- So if you plan to do a presentation: I offer to review your slides / talk - for free of course.
118
- My intention is NOT to change your bias pro / against this tool. Just to help to fix
119
- invalid statements about the tool.
74
+ For higher volumes different arrangements can be negotiated.
120
75
 
121
- Also in many cases a conversation to the author should help you to improve the talk
122
- significantly. One of mutants biggest weaknesses is the bad documentation, but instead of
123
- assumptions based on the absence of docs, use the tool authors brain to fill the gaps.
76
+ ## Topics
124
77
 
125
- Hint, same applies to papers.
126
-
127
- Blog posts
128
- ----------
129
-
130
- Sorted by recency:
131
-
132
- * [A deep dive into mutation testing and how the Mutant gem works][troessner]
133
- * [Keep calm and kill mutants (December, 2015)][itransition]
134
- * [How to write better code using mutation testing (November 2015)][blockscore]
135
- * [How good are your Ruby tests? Testing your tests with mutant (June 2015)][arkency1]
136
- * [Mutation testing and continuous integration (May 2015)][arkency2]
137
- * [Why I want to introduce mutation testing to the `rails_event_store` gem (April 2015)][arkency3]
138
- * [Mutation testing with mutant (April 2014)][sitepoint]
139
- * [Mutation testing with mutant (January 2013)][solnic]
140
-
141
- [troessner]: https://troessner.svbtle.com/kill-all-the-mutants-a-deep-dive-into-mutation-testing-and-how-the-mutant-gem-works
142
- [itransition]: https://github.com/maksar/mentat
143
- [blockscore]: https://blog.blockscore.com/how-to-write-better-code-using-mutation-testing/
144
- [sitepoint]: http://www.sitepoint.com/mutation-testing-mutant/
145
- [arkency1]: http://blog.arkency.com/2015/06/how-good-are-your-ruby-tests-testing-your-tests-with-mutant/
146
- [arkency2]: http://blog.arkency.com/2015/05/mutation-testing-and-continuous-integration/
147
- [arkency3]: http://blog.arkency.com/2015/04/why-i-want-to-introduce-mutation-testing-to-the-rails-event-store-gem/
148
- [solnic]: http://solnic.eu/2013/01/23/mutation-testing-with-mutant.html
149
-
150
- Support
151
- -------
152
-
153
- I'm very happy to receive/answer feedback/questions and criticism.
154
-
155
- Your options:
156
-
157
- * [GitHub Issues](https://github.com/mbj/mutant/issues)
158
- * Ping me on [twitter](https://twitter.com/_m_b_j_)
78
+ * [Nomenclature](/docs/nomenclature.md)
79
+ * [Reading Reports](/docs/reading-reports.md)
80
+ * [Known Problems](/docs/known-problems.md)
81
+ * [Limitations](/docs/limitations.md)
82
+ * [Concurrency](/docs/concurrency.md)
83
+ * [Rspec Integration](/docs/mutant-rspec.md)
84
+ * [Minitest Integration](/docs/mutant-minitest.md)
159
85
 
160
- There is also a mutation testing slack chat. Get an invite [here](https://mutation-testing-slack.herokuapp.com).
161
- For discussing this project, join [#mutant](https://mutation-testing.slack.com/messages/#mutant).
86
+ ## Communication
162
87
 
163
- Other Channels:
88
+ Try the following:
164
89
 
165
- - [#cosmic-ray](https://mutation-testing.slack.com/messages/cosmic-ray): for discussing `cosmic-ray`, the python mutation testing tool.
166
- - [#devtools](https://mutation-testing.slack.com/messages/devtools): for discussing the `devtools` metagem.
167
- - [#general](https://mutation-testing.slack.com/messages/general): for general discussions about mutation testing.
168
- - [#mutagen](https://mutation-testing.slack.com/messages/mutagen): for discussing `mutagen`, the javascript mutation testing tool.
169
- - [#random](https://mutation-testing.slack.com/messages/random): for misc. off topic discussion.
170
- - [#stryker](https://mutation-testing.slack.com/messages/stryker): for discussing `stryker`, the javascript mutation testing tool.
171
- - [#wtf-dev](https://mutation-testing.slack.com/messages/wtf-dev): for sharing software development wtfs.
90
+ * [Github Issues](https://github.com/mbj/mutant/issues)
91
+ * [Release Announcement Mailing List](https://announce.mutant.dev/signup)
92
+ * [Slack channel](mutation-testing.slack.com) request invite from [Markus Schirp](mailto:mbj@schirp-dso.com?subject=Mutation%20Testing%20Slack%20Channel%20Invite).
172
93
 
94
+ ## Sponsoring
173
95
 
174
- Credits
175
- -------
96
+ Mutant, as published in the opensource version, would not exist without the help
97
+ of [contributors](https://github.com/mbj/mutant/graphs/contributors) spending lots
98
+ of their private time.
176
99
 
177
- * [Markus Schirp (mbj)](https://github.com/mbj)
178
- * A gist, now removed, from [dkubb](https://github.com/dkubb) showing ideas.
179
- * Older abandoned [mutant](https://github.com/txus/mutant). For motivating me doing this one.
180
- * [heckle](https://github.com/seattlerb/heckle). For getting me into mutation testing.
100
+ Additionally, the following features where sponsored by organizations:
181
101
 
182
- Contributing
183
- -------------
102
+ * The `mutant-minitest` integration was sponsored by [Arkency](https://arkency.com/)
103
+ * Mutant's initial concurrency support was sponsored by an undisclosed company that does
104
+ currently not wish to be listed here.
184
105
 
185
- * Fork the project.
186
- * Make your feature addition or bug fix.
187
- * Add tests for it. This is important so I don't break it in a
188
- future version unintentionally.
189
- * Commit, do not mess with Rakefile or version
190
- (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)
191
- * Send me a pull request. Bonus points for topic branches.
106
+ ### Legal
192
107
 
193
- License
194
- -------
108
+ Contents of this repository are maintained by:
195
109
 
196
- See LICENSE file.
110
+ ```
111
+ Schirp DSO LTD
112
+ Director: Markus Schirp
113
+ Email: info@schirp-dso.com
114
+ Vat-ID: MT24186727
115
+ Registration: C80467
116
+
117
+ Office address:
118
+ 2, Carob Lane,
119
+ Sir Harry Luke Street
120
+ Naxxar NXR 2209,
121
+ Malta
122
+
123
+ Registred Address
124
+ Phoenix Business Centre,
125
+ The Penthouse,
126
+ Old Railway Track,
127
+ Santa Venera SVR9022,
128
+ Malta
129
+ ```
data/Rakefile CHANGED
@@ -3,24 +3,3 @@
3
3
  require 'devtools'
4
4
 
5
5
  Devtools.init_rake_tasks
6
-
7
- Rake.application.load_imports
8
-
9
- task('metrics:mutant').clear
10
- namespace :metrics do
11
- task mutant: :coverage do
12
- arguments = %w[
13
- bundle exec mutant
14
- --include lib
15
- --since HEAD~1
16
- --require mutant
17
- --use rspec
18
- --zombie
19
- ]
20
- arguments.concat(%w[--jobs 4]) if ENV.key?('CIRCLECI')
21
-
22
- arguments.concat(%w[-- Mutant*])
23
-
24
- Kernel.system(*arguments) or fail 'Mutant task is not successful'
25
- end
26
- end
data/bin/mutant CHANGED
@@ -25,7 +25,6 @@ namespace =
25
25
  includes: %w[
26
26
  mutant
27
27
  unparser
28
- morpher
29
28
  adamantium
30
29
  equalizer
31
30
  anima
@@ -37,4 +36,10 @@ namespace =
37
36
  Mutant
38
37
  end
39
38
 
40
- Kernel.exit(namespace::CLI.run(ARGV))
39
+ Kernel.exit(
40
+ namespace::CLI.run(
41
+ namespace::WORLD,
42
+ namespace::Config::DEFAULT,
43
+ ARGV
44
+ )
45
+ )
@@ -61,6 +61,8 @@ detectors:
61
61
  - Mutant::Mutator
62
62
  - Mutant::Meta::Example::DSL
63
63
  max_ifs: 1
64
+ TooManyConstants:
65
+ enabled: false
64
66
  TooManyInstanceVariables:
65
67
  enabled: true
66
68
  exclude:
@@ -125,7 +127,6 @@ detectors:
125
127
  enabled: true
126
128
  exclude:
127
129
  - Mutant::AST::Sexp#s
128
- - Mutant::Actor::Env#new_mailbox
129
130
  - Mutant::CLI#reporter
130
131
  - Mutant::Integration::Null#call
131
132
  - Mutant::Integration::Rspec#parse_example
@@ -94,10 +94,6 @@ PercentLiteralDelimiters:
94
94
  SymbolArray:
95
95
  Enabled: true
96
96
 
97
- # Align if/else blocks with the variable assignment
98
- EndAlignment:
99
- EnforcedStyleAlignWith: variable
100
-
101
97
  # Prefer #kind_of? over #is_a?
102
98
  ClassCheck:
103
99
  EnforcedStyle: kind_of?
@@ -111,11 +107,9 @@ Metrics/AbcSize:
111
107
  Max: 21.02
112
108
 
113
109
  Metrics/BlockLength:
114
- Enabled: false
115
-
116
- # Do not prefer lambda.call(...) over lambda.(...)
117
- LambdaCall:
118
- Enabled: false
110
+ Exclude:
111
+ - 'spec/**/*.rb'
112
+ - 'mutant.gemspec'
119
113
 
120
114
  # Buggy cop, returns false positive for our code base
121
115
  NonLocalExitFromIterator:
@@ -196,6 +190,8 @@ Style/CommentedKeyword:
196
190
  Enabled: false
197
191
  Style/MixinGrouping:
198
192
  Enabled: false
193
+ Style/RaiseArgs:
194
+ Enabled: false
199
195
  Style/RescueStandardError:
200
196
  Enabled: false
201
197
  Style/StderrPuts:
@@ -0,0 +1,76 @@
1
+ # Incremental mutation testing
2
+
3
+ Incremental mutation testing allows you to significantly speed up mutation
4
+ analysis, via skipping over subjects that are not changed.
5
+
6
+ This is an explicit trade off, often worth the downsides.
7
+
8
+ ## Motivation
9
+
10
+ Despite all efforts in setting up a project for maximum mutation testing
11
+ efficiency, running a full pass over all available subjects is not always
12
+ desired. On building your branches on CI, and during local commit stage, its
13
+ instead more efficient to scope the Mutant run to everything that was
14
+ touched in the current branch / commit. The working set of subjects.
15
+
16
+ For not having to manually keep track of the working set, the `--since` option
17
+ allows you to specify a git reference point. Mutant will automatically subset all
18
+ available subjects to the ones that where touched since the reference point.
19
+
20
+ ## Usage
21
+
22
+ Use the `--since git-reference` flag to enable automatic filtering of the
23
+ matched subjects to the ones that have a line changed since the reference
24
+ point.
25
+
26
+ Internally mutant will use the semantics of `git diff git-reference` to
27
+ determine which subjects have changes. A subject is selected by this mechanism
28
+ when `git diff` reports a hunk that overlaps with the current subjects line
29
+ range.
30
+
31
+ ## Example
32
+
33
+ On a branch, executing:
34
+
35
+ ```
36
+ mutant --since master 'ProjectNamespace*'
37
+ ```
38
+
39
+ Will run mutation testing against all subjects that have a direct source code
40
+ since the `master` branch. Assuming your project has 100 subjects, and you
41
+ touched 2 of them in your branch: Mutant will only select these 2 subjects for
42
+ mutation testing.
43
+
44
+ ## Recommended use
45
+
46
+ Use incremental for any project where a full pass does not fit within acceptable
47
+ round trip times for the human mind.
48
+
49
+ A small 200 loc gem, should probably never use it. Typically its the local per
50
+ developer environment that should use incremental first. On CI its recommended
51
+ to stay with the full pass as long as possible and switch to incremental mode
52
+ when the CI cycle time gets too annoying.
53
+
54
+ In addition, once using incremental its recommended to run a full pass as a
55
+ nightly job.
56
+
57
+ Incremental is also a good mode to retrofit mutation testing into a legacy
58
+ project.
59
+
60
+ Good selectors for reference points are `HEAD~1` (the previous commit) or
61
+ `master` (the integration branch).
62
+
63
+ ## Limitations
64
+
65
+ Mutant only triggers incremental subject selection for *direct* code changes.
66
+ It'll currently not select subjects that where indirectly changed.
67
+
68
+ Counter examples:
69
+
70
+ * A change to a constant that results in a behavior change of a subject will
71
+ not trigger that subject to be selected.
72
+ * A change to a subject A that causes another subject B to change in behavior,
73
+ will not select subject B.
74
+
75
+ These limitations may be removed in future versions of mutant, work on more
76
+ fine grained tracing is underway.
@@ -1,20 +1,6 @@
1
1
  Known Problems
2
2
  ==============
3
3
 
4
- Mutations with Infinite Runtimes
5
- ---------------------------------
6
-
7
- Occasionally mutant will produce a mutation with an infinite runtime. When this happens
8
- mutant will look like it is running indefinitely without killing a remaining mutation. To
9
- avoid mutations like this, consider adding a timeout around your tests. For example, in
10
- RSpec you can add the following to your `spec_helper`:
11
- ```ruby
12
- config.around(:each) do |example|
13
- Timeout.timeout(5, &example)
14
- end
15
- ```
16
- which will fail specs which run for longer than 5 seconds.
17
-
18
4
  The Crash / Stuck Problem (MRI)
19
5
  -------------------------------
20
6