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.
Files changed (225) hide show
  1. data/.gitignore +5 -11
  2. data/.rspec +0 -1
  3. data/.travis.yml +14 -3
  4. data/Changelog.md +3 -0
  5. data/Gemfile +5 -1
  6. data/Gemfile.devtools +49 -0
  7. data/Guardfile +18 -0
  8. data/README.md +67 -0
  9. data/Rakefile +4 -1
  10. data/TODO +13 -0
  11. data/bin/mutant +14 -0
  12. data/bin/zombie +14 -0
  13. data/config/flay.yml +3 -0
  14. data/config/flog.yml +2 -0
  15. data/config/roodi.yml +26 -0
  16. data/config/site.reek +93 -0
  17. data/config/yardstick.yml +2 -0
  18. data/lib/inflector.rb +7 -0
  19. data/lib/inflector/defaults.rb +62 -0
  20. data/lib/inflector/inflections.rb +209 -0
  21. data/lib/inflector/methods.rb +149 -0
  22. data/lib/inflector/version.rb +3 -0
  23. data/lib/mutant.rb +96 -21
  24. data/lib/mutant/cli.rb +309 -0
  25. data/lib/mutant/color.rb +61 -0
  26. data/lib/mutant/context.rb +36 -0
  27. data/lib/mutant/context/scope.rb +138 -0
  28. data/lib/mutant/differ.rb +100 -0
  29. data/lib/mutant/helper.rb +38 -0
  30. data/lib/mutant/killer.rb +136 -0
  31. data/lib/mutant/killer/forking.rb +41 -0
  32. data/lib/mutant/killer/rspec.rb +49 -0
  33. data/lib/mutant/killer/static.rb +19 -0
  34. data/lib/mutant/loader.rb +129 -0
  35. data/lib/mutant/matcher.rb +55 -0
  36. data/lib/mutant/matcher/chain.rb +66 -0
  37. data/lib/mutant/matcher/method.rb +173 -0
  38. data/lib/mutant/matcher/method/classifier.rb +126 -0
  39. data/lib/mutant/matcher/method/instance.rb +67 -0
  40. data/lib/mutant/matcher/method/singleton.rb +141 -0
  41. data/lib/mutant/matcher/object_space.rb +114 -0
  42. data/lib/mutant/matcher/scope_methods.rb +127 -0
  43. data/lib/mutant/mutation.rb +101 -12
  44. data/lib/mutant/mutation/filter.rb +75 -0
  45. data/lib/mutant/mutation/filter/code.rb +68 -0
  46. data/lib/mutant/mutation/filter/regexp.rb +39 -0
  47. data/lib/mutant/mutation/filter/whitelist.rb +47 -0
  48. data/lib/mutant/mutator.rb +134 -30
  49. data/lib/mutant/mutator/node.rb +163 -0
  50. data/lib/mutant/mutator/node/arguments.rb +24 -0
  51. data/lib/mutant/mutator/node/block.rb +24 -0
  52. data/lib/mutant/mutator/node/define.rb +24 -0
  53. data/lib/mutant/mutator/node/if_statement.rb +93 -0
  54. data/lib/mutant/mutator/node/literal.rb +54 -0
  55. data/lib/mutant/mutator/node/literal/array.rb +28 -0
  56. data/lib/mutant/mutator/node/literal/boolean.rb +49 -0
  57. data/lib/mutant/mutator/node/literal/dynamic.rb +24 -0
  58. data/lib/mutant/mutator/node/literal/empty_array.rb +26 -0
  59. data/lib/mutant/mutator/node/literal/fixnum.rb +37 -0
  60. data/lib/mutant/mutator/node/literal/float.rb +48 -0
  61. data/lib/mutant/mutator/node/literal/hash.rb +89 -0
  62. data/lib/mutant/mutator/node/literal/nil.rb +25 -0
  63. data/lib/mutant/mutator/node/literal/range.rb +94 -0
  64. data/lib/mutant/mutator/node/literal/regex.rb +43 -0
  65. data/lib/mutant/mutator/node/literal/string.rb +26 -0
  66. data/lib/mutant/mutator/node/literal/symbol.rb +26 -0
  67. data/lib/mutant/mutator/node/noop.rb +55 -0
  68. data/lib/mutant/mutator/node/receiver_case.rb +140 -0
  69. data/lib/mutant/mutator/node/return.rb +31 -0
  70. data/lib/mutant/mutator/node/send.rb +112 -0
  71. data/lib/mutant/mutator/registry.rb +48 -0
  72. data/lib/mutant/mutator/util.rb +87 -0
  73. data/lib/mutant/random.rb +24 -27
  74. data/lib/mutant/reporter.rb +48 -30
  75. data/lib/mutant/reporter/cli.rb +221 -0
  76. data/lib/mutant/reporter/null.rb +42 -0
  77. data/lib/mutant/reporter/stats.rb +64 -0
  78. data/lib/mutant/runner.rb +112 -0
  79. data/lib/mutant/strategy.rb +42 -0
  80. data/lib/mutant/strategy/rspec.rb +59 -0
  81. data/lib/mutant/strategy/rspec/example_lookup.rb +122 -0
  82. data/lib/mutant/subject.rb +115 -0
  83. data/lib/mutant/support/method_object.rb +31 -0
  84. data/locator.rb +87 -0
  85. data/mutant.gemspec +21 -21
  86. data/spec/integration/mutant/differ_spec.rb +15 -0
  87. data/spec/integration/mutant/loader_spec.rb +21 -0
  88. data/spec/integration/mutant/method_matching_spec.rb +269 -0
  89. data/spec/integration/mutant/rspec_killer_spec.rb +24 -0
  90. data/spec/integration/mutant/runner_spec.rb +26 -0
  91. data/spec/integration/mutant/zombie_spec.rb +8 -0
  92. data/spec/rcov.opts +7 -0
  93. data/spec/shared/command_method_behavior.rb +7 -0
  94. data/spec/shared/each_method_behaviour.rb +15 -0
  95. data/spec/shared/hash_method_behavior.rb +17 -0
  96. data/spec/shared/idempotent_method_behavior.rb +7 -0
  97. data/spec/shared/invertible_method_behaviour.rb +9 -0
  98. data/spec/shared/method_filter_parse_behavior.rb +16 -0
  99. data/spec/shared/method_match_behavior.rb +39 -0
  100. data/spec/shared/mutator_behavior.rb +46 -0
  101. data/spec/spec_helper.rb +11 -14
  102. data/spec/support/compress_helper.rb +10 -0
  103. data/spec/support/rspec.rb +22 -0
  104. data/spec/support/test_app.rb +5 -0
  105. data/spec/support/zombie.rb +141 -0
  106. data/spec/unit/mutant/cli/class_methods/new_spec.rb +87 -0
  107. data/spec/unit/mutant/cli/class_methods/run_spec.rb +38 -0
  108. data/spec/unit/mutant/context/root_spec.rb +11 -0
  109. data/spec/unit/mutant/context/scope/class_methods/build_spec.rb +29 -0
  110. data/spec/unit/mutant/context/scope/root_spec.rb +22 -0
  111. data/spec/unit/mutant/context/scope/unqualified_name_spec.rb +27 -0
  112. data/spec/unit/mutant/killer/fail_ques_spec.rb +39 -0
  113. data/spec/unit/mutant/killer/rspec/class_methods/new_spec.rb +32 -0
  114. data/spec/unit/mutant/loader/eval/class_methods/run_spec.rb +33 -0
  115. data/spec/unit/mutant/loader/rubinius/class_methods/run_spec.rb +42 -0
  116. data/spec/unit/mutant/matcher/chain/each_spec.rb +37 -0
  117. data/spec/unit/mutant/matcher/chain/matchers_spec.rb +12 -0
  118. data/spec/unit/mutant/matcher/class_methods/from_string_spec.rb +49 -0
  119. data/spec/unit/mutant/matcher/class_methods/parse_spec.rb +12 -0
  120. data/spec/unit/mutant/matcher/each_spec.rb +14 -0
  121. data/spec/unit/mutant/matcher/method/class_methods/parse_spec.rb +21 -0
  122. data/spec/unit/mutant/matcher/method/classifier/class_methods/run_spec.rb +34 -0
  123. data/spec/unit/mutant/matcher/method/method_spec.rb +11 -0
  124. data/spec/unit/mutant/matcher/object_space/class_methods/parse_spec.rb +24 -0
  125. data/spec/unit/mutant/matcher/object_space/each_spec.rb +31 -0
  126. data/spec/unit/mutant/mutator/each_spec.rb +25 -0
  127. data/spec/unit/mutant/mutator/emit_new_spec.rb +51 -0
  128. data/spec/unit/mutant/mutator/emit_spec.rb +52 -0
  129. data/spec/unit/mutant/mutator/node/block/mutation_spec.rb +36 -0
  130. data/spec/unit/mutant/mutator/node/define/mutation_spec.rb +47 -0
  131. data/spec/unit/mutant/mutator/node/if_statement/mutation_spec.rb +30 -0
  132. data/spec/unit/mutant/mutator/node/literal/array_spec.rb +30 -0
  133. data/spec/unit/mutant/mutator/node/literal/boolean/mutation_spec.rb +23 -0
  134. data/spec/unit/mutant/mutator/node/literal/empty_array_spec.rb +17 -0
  135. data/spec/unit/mutant/mutator/node/literal/fixnum_spec.rb +17 -0
  136. data/spec/unit/mutant/mutator/node/literal/float_spec.rb +25 -0
  137. data/spec/unit/mutant/mutator/node/literal/hash_spec.rb +34 -0
  138. data/spec/unit/mutant/mutator/node/literal/nil_spec.rb +13 -0
  139. data/spec/unit/mutant/mutator/node/literal/range_spec.rb +35 -0
  140. data/spec/unit/mutant/mutator/node/literal/regex_spec.rb +23 -0
  141. data/spec/unit/mutant/mutator/node/literal/string_spec.rb +17 -0
  142. data/spec/unit/mutant/mutator/node/literal/symbol_spec.rb +17 -0
  143. data/spec/unit/mutant/mutator/node/receiver_case/mutation_spec.rb +27 -0
  144. data/spec/unit/mutant/mutator/node/return/mutation_spec.rb +21 -0
  145. data/spec/unit/mutant/mutator/node/send/mutation_spec.rb +78 -0
  146. data/spec/unit/mutant/mutator/self_spec.rb +7 -0
  147. data/spec/unit/mutant/subject/class_methods/new_spec.rb +13 -0
  148. data/spec/unit/mutant/subject/context_spec.rb +14 -0
  149. data/spec/unit/mutant/subject/each_spec.rb +35 -0
  150. data/spec/unit/mutant/subject/node_spec.rb +13 -0
  151. data/tasks/metrics/ci.rake +7 -0
  152. data/tasks/metrics/flay.rake +41 -0
  153. data/tasks/metrics/flog.rake +43 -0
  154. data/tasks/metrics/heckle.rake +216 -0
  155. data/tasks/metrics/metric_fu.rake +31 -0
  156. data/tasks/metrics/reek.rake +15 -0
  157. data/tasks/metrics/roodi.rake +15 -0
  158. data/tasks/metrics/yardstick.rake +23 -0
  159. data/tasks/spec.rake +45 -0
  160. data/tasks/yard.rake +9 -0
  161. data/test_app/.rspec +1 -0
  162. data/test_app/lib/test_app.rb +5 -0
  163. data/test_app/lib/test_app/literal.rb +32 -0
  164. data/test_app/spec/shared/command_method_behavior.rb +7 -0
  165. data/test_app/spec/shared/each_method_behaviour.rb +15 -0
  166. data/test_app/spec/shared/hash_method_behavior.rb +17 -0
  167. data/test_app/spec/shared/idempotent_method_behavior.rb +7 -0
  168. data/test_app/spec/shared/invertible_method_behaviour.rb +9 -0
  169. data/test_app/spec/shared/method_filter_parse_behavior.rb +16 -0
  170. data/test_app/spec/shared/method_match_behavior.rb +39 -0
  171. data/test_app/spec/shared/mutator_behavior.rb +44 -0
  172. data/test_app/spec/spec_helper.rb +7 -0
  173. data/test_app/spec/unit/test_app/literal/command_spec.rb +9 -0
  174. data/test_app/spec/unit/test_app/literal/string_spec.rb +9 -0
  175. metadata +346 -124
  176. data/.rvmrc +0 -1
  177. data/Readme.md +0 -13
  178. data/exe/mutate +0 -6
  179. data/lib/mutant/extensions.rb +0 -8
  180. data/lib/mutant/formatter.rb +0 -19
  181. data/lib/mutant/implementation.rb +0 -70
  182. data/lib/mutant/literal.rb +0 -147
  183. data/lib/mutant/method.rb +0 -31
  184. data/lib/mutant/mutatee.rb +0 -61
  185. data/lib/mutant/node.rb +0 -26
  186. data/lib/mutant/runners/rspec.rb +0 -34
  187. data/lib/mutant/version.rb +0 -3
  188. data/spec/functional/class_spec.rb +0 -46
  189. data/spec/functional/instance_method/array_spec.rb +0 -53
  190. data/spec/functional/instance_method/boolean_spec.rb +0 -101
  191. data/spec/functional/instance_method/call_spec.rb +0 -161
  192. data/spec/functional/instance_method/fixnum_spec.rb +0 -53
  193. data/spec/functional/instance_method/float_spec.rb +0 -53
  194. data/spec/functional/instance_method/hash_spec.rb +0 -53
  195. data/spec/functional/instance_method/if_spec.rb +0 -57
  196. data/spec/functional/instance_method/ivar_assign_spec.rb +0 -62
  197. data/spec/functional/instance_method/range_spec.rb +0 -53
  198. data/spec/functional/instance_method/regex_spec.rb +0 -55
  199. data/spec/functional/instance_method/string_spec.rb +0 -53
  200. data/spec/functional/instance_method/symbol_spec.rb +0 -53
  201. data/spec/functional/reporter/method_loaded_spec.rb +0 -62
  202. data/spec/functional/reporter/running_mutations_spec.rb +0 -60
  203. data/spec/functional/runners/rspec_spec.rb +0 -26
  204. data/spec/functional/singleton_method/array_spec.rb +0 -53
  205. data/spec/functional/singleton_method/boolean_spec.rb +0 -101
  206. data/spec/functional/singleton_method/call_spec.rb +0 -161
  207. data/spec/functional/singleton_method/fixnum_spec.rb +0 -53
  208. data/spec/functional/singleton_method/float_spec.rb +0 -53
  209. data/spec/functional/singleton_method/hash_spec.rb +0 -53
  210. data/spec/functional/singleton_method/if_spec.rb +0 -57
  211. data/spec/functional/singleton_method/ivar_assign_spec.rb +0 -60
  212. data/spec/functional/singleton_method/range_spec.rb +0 -53
  213. data/spec/functional/singleton_method/regex_spec.rb +0 -55
  214. data/spec/functional/singleton_method/string_spec.rb +0 -53
  215. data/spec/functional/singleton_method/symbol_spec.rb +0 -53
  216. data/spec/mutant/extensions_spec.rb +0 -13
  217. data/spec/mutant/implementation_spec.rb +0 -223
  218. data/spec/mutant/literal_spec.rb +0 -129
  219. data/spec/mutant/mutatee_spec.rb +0 -28
  220. data/spec/mutant/node_spec.rb +0 -41
  221. data/spec/mutant/random_spec.rb +0 -33
  222. data/spec/mutant/reporter_spec.rb +0 -17
  223. data/spec/mutant_spec.rb +0 -28
  224. data/spec/support/example_group_helpers.rb +0 -11
  225. data/spec/support/example_helpers.rb +0 -5
data/.gitignore CHANGED
@@ -1,11 +1,5 @@
1
- .DS_Store
2
- *.gem
3
- .bundle
4
- Gemfile.lock
5
- pkg/*
6
- tmp
7
- *.rbx
8
- *.rbc
9
- bin
10
- .rbx
11
- test_spec.rb
1
+ /.rbx
2
+ /Gemfile.lock
3
+ /tmp
4
+ /coverage
5
+ /test_app/.rbx
data/.rspec CHANGED
@@ -1,2 +1 @@
1
- --default_path spec
2
1
  --color
@@ -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
- bundler_args: "--binstubs"
6
- script: "bin/rspec spec"
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: rbx-19mode
14
+ - rvm: 1.8.7
15
+ notifications:
16
+ email:
17
+ - mbj@seonic.net
@@ -0,0 +1,3 @@
1
+ # v0.0.1 2012-12-07
2
+
3
+ First public release!
data/Gemfile CHANGED
@@ -1,2 +1,6 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
+
2
3
  gemspec
4
+
5
+ gem 'devtools', :git => 'https://github.com/mbj/devtools.git', :branch => :'rspec-2-mutant'
6
+ eval(File.read(File.join(File.dirname(__FILE__),'Gemfile.devtools')))
@@ -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
@@ -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
@@ -0,0 +1,67 @@
1
+ mutant
2
+ ======
3
+
4
+ [![Build Status](https://secure.travis-ci.org/mbj/mutant.png?branch=master)](http://travis-ci.org/mbj/mutant)
5
+ [![Dependency Status](https://gemnasium.com/mbj/mutant.png)](https://gemnasium.com/mbj/mutant)
6
+ [![Code Climate](https://codeclimate.com/badge.png)](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
@@ -1 +1,4 @@
1
- require 'bundler/gem_tasks'
1
+ require 'rake'
2
+ require 'devtools'
3
+
4
+ Devtools.init
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.
@@ -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))
@@ -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))
@@ -0,0 +1,3 @@
1
+ ---
2
+ threshold: 18
3
+ total_score: 750
@@ -0,0 +1,2 @@
1
+ ---
2
+ threshold: 14.4
@@ -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
@@ -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
@@ -0,0 +1,2 @@
1
+ ---
2
+ threshold: 100
@@ -0,0 +1,7 @@
1
+ # Library namespace
2
+ module Inflector
3
+ end
4
+
5
+ require 'inflector/inflections'
6
+ require 'inflector/defaults'
7
+ require 'inflector/methods'
@@ -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