reek 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. data/.yardopts +10 -0
  2. data/History.txt +20 -0
  3. data/README.md +90 -0
  4. data/bin/reek +2 -2
  5. data/config/defaults.reek +34 -4
  6. data/features/masking_smells.feature +35 -15
  7. data/features/options.feature +2 -0
  8. data/features/rake_task.feature +11 -18
  9. data/features/reports.feature +13 -15
  10. data/features/samples.feature +90 -105
  11. data/features/stdin.feature +3 -6
  12. data/features/step_definitions/reek_steps.rb +8 -4
  13. data/features/support/env.rb +2 -3
  14. data/features/yaml.feature +124 -0
  15. data/lib/reek.rb +8 -4
  16. data/lib/reek/cli/application.rb +46 -0
  17. data/lib/reek/cli/command_line.rb +106 -0
  18. data/lib/reek/cli/help_command.rb +18 -0
  19. data/lib/reek/cli/reek_command.rb +37 -0
  20. data/lib/reek/cli/report.rb +91 -0
  21. data/lib/reek/cli/version_command.rb +19 -0
  22. data/lib/reek/cli/yaml_command.rb +32 -0
  23. data/lib/reek/core/block_context.rb +18 -0
  24. data/lib/reek/core/class_context.rb +23 -0
  25. data/lib/reek/core/code_context.rb +72 -0
  26. data/lib/reek/core/code_parser.rb +192 -0
  27. data/lib/reek/core/detector_stack.rb +29 -0
  28. data/lib/reek/core/masking_collection.rb +46 -0
  29. data/lib/reek/core/method_context.rb +132 -0
  30. data/lib/reek/core/module_context.rb +64 -0
  31. data/lib/reek/{object_refs.rb → core/object_refs.rb} +8 -6
  32. data/lib/reek/{singleton_method_context.rb → core/singleton_method_context.rb} +10 -5
  33. data/lib/reek/core/smell_configuration.rb +66 -0
  34. data/lib/reek/core/sniffer.rb +110 -0
  35. data/lib/reek/core/stop_context.rb +26 -0
  36. data/lib/reek/examiner.rb +88 -0
  37. data/lib/reek/rake/task.rb +124 -0
  38. data/lib/reek/smell_warning.rb +69 -13
  39. data/lib/reek/smells.rb +29 -0
  40. data/lib/reek/smells/attribute.rb +13 -14
  41. data/lib/reek/smells/boolean_parameter.rb +33 -0
  42. data/lib/reek/smells/class_variable.rb +8 -6
  43. data/lib/reek/smells/control_couple.rb +33 -17
  44. data/lib/reek/smells/data_clump.rb +10 -6
  45. data/lib/reek/smells/duplication.rb +24 -14
  46. data/lib/reek/smells/feature_envy.rb +11 -6
  47. data/lib/reek/smells/irresponsible_module.rb +28 -0
  48. data/lib/reek/smells/large_class.rb +9 -7
  49. data/lib/reek/smells/long_method.rb +6 -5
  50. data/lib/reek/smells/long_parameter_list.rb +11 -9
  51. data/lib/reek/smells/long_yield_list.rb +37 -7
  52. data/lib/reek/smells/nested_iterators.rb +34 -9
  53. data/lib/reek/smells/simulated_polymorphism.rb +15 -11
  54. data/lib/reek/smells/smell_detector.rb +24 -12
  55. data/lib/reek/smells/uncommunicative_method_name.rb +76 -0
  56. data/lib/reek/smells/uncommunicative_module_name.rb +76 -0
  57. data/lib/reek/smells/{uncommunicative_name.rb → uncommunicative_parameter_name.rb} +14 -26
  58. data/lib/reek/smells/uncommunicative_variable_name.rb +90 -0
  59. data/lib/reek/smells/utility_function.rb +33 -9
  60. data/lib/reek/source.rb +18 -0
  61. data/lib/reek/source/code_comment.rb +19 -0
  62. data/lib/reek/source/config_file.rb +72 -0
  63. data/lib/reek/source/core_extras.rb +46 -0
  64. data/lib/reek/source/sexp_formatter.rb +16 -0
  65. data/lib/reek/source/source_code.rb +44 -0
  66. data/lib/reek/source/source_file.rb +32 -0
  67. data/lib/reek/source/source_locator.rb +36 -0
  68. data/lib/reek/source/tree_dresser.rb +128 -0
  69. data/lib/reek/spec.rb +51 -0
  70. data/lib/reek/spec/should_reek.rb +34 -0
  71. data/lib/reek/spec/should_reek_of.rb +37 -0
  72. data/lib/reek/spec/should_reek_only_of.rb +36 -0
  73. data/reek.gemspec +5 -5
  74. data/spec/reek/{help_command_spec.rb → cli/help_command_spec.rb} +3 -4
  75. data/spec/reek/{reek_command_spec.rb → cli/reek_command_spec.rb} +8 -7
  76. data/spec/reek/cli/report_spec.rb +26 -0
  77. data/spec/reek/{version_command_spec.rb → cli/version_command_spec.rb} +3 -3
  78. data/spec/reek/cli/yaml_command_spec.rb +47 -0
  79. data/spec/reek/core/block_context_spec.rb +26 -0
  80. data/spec/reek/core/class_context_spec.rb +53 -0
  81. data/spec/reek/{code_context_spec.rb → core/code_context_spec.rb} +15 -37
  82. data/spec/reek/{code_parser_spec.rb → core/code_parser_spec.rb} +5 -5
  83. data/spec/reek/{config_spec.rb → core/config_spec.rb} +2 -6
  84. data/spec/reek/{masking_collection_spec.rb → core/masking_collection_spec.rb} +3 -4
  85. data/spec/reek/{method_context_spec.rb → core/method_context_spec.rb} +6 -7
  86. data/spec/reek/core/module_context_spec.rb +42 -0
  87. data/spec/reek/{object_refs_spec.rb → core/object_refs_spec.rb} +5 -6
  88. data/spec/reek/core/singleton_method_context_spec.rb +15 -0
  89. data/spec/reek/core/smell_configuration_spec.rb +11 -0
  90. data/spec/reek/core/stop_context_spec.rb +17 -0
  91. data/spec/reek/examiner_spec.rb +42 -0
  92. data/spec/reek/smell_warning_spec.rb +82 -33
  93. data/spec/reek/smells/attribute_spec.rb +33 -7
  94. data/spec/reek/smells/boolean_parameter_spec.rb +76 -0
  95. data/spec/reek/smells/class_variable_spec.rb +15 -6
  96. data/spec/reek/smells/control_couple_spec.rb +40 -29
  97. data/spec/reek/smells/data_clump_spec.rb +28 -7
  98. data/spec/reek/smells/duplication_spec.rb +47 -41
  99. data/spec/reek/smells/feature_envy_spec.rb +76 -18
  100. data/spec/reek/smells/irresponsible_module_spec.rb +37 -0
  101. data/spec/reek/smells/large_class_spec.rb +91 -56
  102. data/spec/reek/smells/long_method_spec.rb +32 -7
  103. data/spec/reek/smells/long_parameter_list_spec.rb +42 -13
  104. data/spec/reek/smells/long_yield_list_spec.rb +65 -0
  105. data/spec/reek/smells/nested_iterators_spec.rb +94 -3
  106. data/spec/reek/smells/simulated_polymorphism_spec.rb +48 -20
  107. data/spec/reek/smells/smell_detector_shared.rb +28 -0
  108. data/spec/reek/smells/uncommunicative_method_name_spec.rb +57 -0
  109. data/spec/reek/smells/uncommunicative_module_name_spec.rb +67 -0
  110. data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +61 -0
  111. data/spec/reek/smells/uncommunicative_variable_name_spec.rb +124 -0
  112. data/spec/reek/smells/utility_function_spec.rb +45 -3
  113. data/spec/reek/source/code_comment_spec.rb +24 -0
  114. data/spec/reek/source/object_source_spec.rb +20 -0
  115. data/spec/reek/{adapters/source_spec.rb → source/source_code_spec.rb} +7 -8
  116. data/spec/reek/source/tree_dresser_spec.rb +165 -0
  117. data/spec/reek/spec/should_reek_of_spec.rb +76 -0
  118. data/spec/reek/spec/should_reek_only_of_spec.rb +89 -0
  119. data/spec/reek/{adapters → spec}/should_reek_spec.rb +8 -32
  120. data/spec/samples/all_but_one_masked/clean_one.rb +1 -0
  121. data/spec/samples/all_but_one_masked/dirty.rb +1 -0
  122. data/spec/samples/all_but_one_masked/masked.reek +5 -1
  123. data/spec/samples/clean_due_to_masking/clean_one.rb +1 -0
  124. data/spec/samples/clean_due_to_masking/clean_three.rb +1 -0
  125. data/spec/samples/clean_due_to_masking/clean_two.rb +1 -0
  126. data/spec/samples/clean_due_to_masking/dirty_one.rb +1 -1
  127. data/spec/samples/clean_due_to_masking/dirty_two.rb +1 -1
  128. data/spec/samples/clean_due_to_masking/masked.reek +5 -1
  129. data/spec/samples/corrupt_config_file/dirty.rb +1 -1
  130. data/spec/samples/empty_config_file/dirty.rb +2 -1
  131. data/spec/samples/exceptions.reek +1 -1
  132. data/spec/samples/masked/dirty.rb +2 -1
  133. data/spec/samples/masked/masked.reek +3 -1
  134. data/spec/samples/mixed_results/clean_one.rb +1 -0
  135. data/spec/samples/mixed_results/clean_three.rb +1 -0
  136. data/spec/samples/mixed_results/clean_two.rb +1 -0
  137. data/spec/samples/mixed_results/dirty_one.rb +1 -0
  138. data/spec/samples/mixed_results/dirty_two.rb +1 -0
  139. data/spec/samples/not_quite_masked/dirty.rb +2 -1
  140. data/spec/samples/not_quite_masked/masked.reek +1 -1
  141. data/spec/samples/overrides/masked/dirty.rb +2 -1
  142. data/spec/samples/overrides/masked/lower.reek +3 -1
  143. data/spec/samples/three_clean_files/clean_one.rb +1 -0
  144. data/spec/samples/three_clean_files/clean_three.rb +1 -0
  145. data/spec/samples/three_clean_files/clean_two.rb +1 -0
  146. data/spec/samples/two_smelly_files/dirty_one.rb +2 -1
  147. data/spec/samples/two_smelly_files/dirty_two.rb +2 -1
  148. data/spec/spec_helper.rb +1 -2
  149. data/tasks/reek.rake +2 -2
  150. data/tasks/test.rake +12 -3
  151. metadata +81 -62
  152. data/README.rdoc +0 -84
  153. data/lib/reek/adapters/application.rb +0 -46
  154. data/lib/reek/adapters/command_line.rb +0 -77
  155. data/lib/reek/adapters/config_file.rb +0 -31
  156. data/lib/reek/adapters/core_extras.rb +0 -64
  157. data/lib/reek/adapters/rake_task.rb +0 -121
  158. data/lib/reek/adapters/report.rb +0 -86
  159. data/lib/reek/adapters/source.rb +0 -72
  160. data/lib/reek/adapters/spec.rb +0 -133
  161. data/lib/reek/block_context.rb +0 -62
  162. data/lib/reek/class_context.rb +0 -41
  163. data/lib/reek/code_context.rb +0 -68
  164. data/lib/reek/code_parser.rb +0 -203
  165. data/lib/reek/configuration.rb +0 -57
  166. data/lib/reek/detector_stack.rb +0 -37
  167. data/lib/reek/help_command.rb +0 -14
  168. data/lib/reek/if_context.rb +0 -18
  169. data/lib/reek/masking_collection.rb +0 -33
  170. data/lib/reek/method_context.rb +0 -138
  171. data/lib/reek/module_context.rb +0 -49
  172. data/lib/reek/name.rb +0 -57
  173. data/lib/reek/reek_command.rb +0 -28
  174. data/lib/reek/sexp_formatter.rb +0 -10
  175. data/lib/reek/sniffer.rb +0 -177
  176. data/lib/reek/stop_context.rb +0 -35
  177. data/lib/reek/tree_dresser.rb +0 -82
  178. data/lib/reek/version_command.rb +0 -14
  179. data/lib/reek/yield_call_context.rb +0 -12
  180. data/spec/reek/adapters/report_spec.rb +0 -31
  181. data/spec/reek/adapters/should_reek_of_spec.rb +0 -138
  182. data/spec/reek/adapters/should_reek_only_of_spec.rb +0 -87
  183. data/spec/reek/block_context_spec.rb +0 -65
  184. data/spec/reek/class_context_spec.rb +0 -161
  185. data/spec/reek/configuration_spec.rb +0 -12
  186. data/spec/reek/if_context_spec.rb +0 -17
  187. data/spec/reek/module_context_spec.rb +0 -46
  188. data/spec/reek/name_spec.rb +0 -37
  189. data/spec/reek/object_source_spec.rb +0 -23
  190. data/spec/reek/singleton_method_context_spec.rb +0 -16
  191. data/spec/reek/smells/smell_detector_spec.rb +0 -36
  192. data/spec/reek/smells/uncommunicative_name_spec.rb +0 -146
  193. data/spec/reek/sniffer_spec.rb +0 -11
  194. data/spec/reek/stop_context_spec.rb +0 -33
  195. data/spec/reek/tree_dresser_spec.rb +0 -20
@@ -0,0 +1,10 @@
1
+ --no-private
2
+ --readme README.md
3
+ lib/reek.rb
4
+ lib/reek/*.rb
5
+ lib/reek/smells/*.rb
6
+ lib/reek/source/*.rb
7
+ lib/reek/spec/*.rb
8
+ lib/reek/rake/*.rb
9
+ -
10
+ *.txt
@@ -1,3 +1,23 @@
1
+ == 1.2.7 (in development)
2
+
3
+ === Major Changes
4
+ * New option --yaml reports smells in YAML format
5
+ * Now require 'reek/rake/task' to use the rake task
6
+ * Now require 'reek/spec' to use the Rspec matchers
7
+ * Developer API completely revised and documented
8
+
9
+ === Minor Changes
10
+ * New smell: Irresponsible Module (has no meaningful comment)
11
+ * ControlCouple no longer checks arguments yielded to blocks
12
+ * FeatureEnvy and UtilityFunction are now subclasses of a new smell: LowCohesion
13
+ * NestedIterators now reports the nesting depth
14
+ * Fixed problem checking for UtilityFunctions in Object
15
+ * Improved detection of invalid config files
16
+ * Invalid config files are now ignored
17
+ * Non-existent files are now ignored
18
+
19
+ See http://wiki.github.com/kevinrutherford/reek for further details.
20
+
1
21
  == 1.2.6 (2009-11-28)
2
22
 
3
23
  === Minor Changes
@@ -0,0 +1,90 @@
1
+ Reek -- code smell detection for Ruby
2
+ =====================================
3
+
4
+ Reek is a tool that examines Ruby classes, modules and methods and
5
+ reports any code smells it finds. Install it like this:
6
+
7
+ $ gem install reek
8
+
9
+ and run it like this:
10
+
11
+ $ reek [options] [dir_or_source_file]*
12
+
13
+ For a full list of command-line options see the Reek
14
+ wiki[http://wiki.github.com/kevinrutherford/reek/command-line-options]
15
+ or run
16
+
17
+ $ reek --help
18
+
19
+ Example
20
+ -------
21
+
22
+ Imagine a source file <tt>csv_writer.rb</tt> containing:
23
+
24
+ class CsvWriter
25
+ def write_line(fields)
26
+ if (fields.length == 0)
27
+ puts
28
+ else
29
+ write_field(fields[0])
30
+ 1.upto(fields.length-1) do |i|
31
+ print ","
32
+ write_field(fields[i])
33
+ end
34
+ puts
35
+ end
36
+ end
37
+
38
+ #...
39
+ end
40
+
41
+ Reek will report the following code smells in this file:
42
+
43
+ $ reek csv_writer.rb
44
+ CsvWriter#write_line calls fields.length multiple times (Duplication)
45
+ CsvWriter#write_line has approx 6 statements (Long Method)
46
+ CsvWriter#write_line/block has the variable name 'i' (Uncommunicative Name)
47
+
48
+ Features
49
+ --------
50
+
51
+ Reek currently includes checks for some aspects of the following smells:
52
+
53
+ * [Control Couple](http://wiki.github.com/kevinrutherford/reek/control-couple)
54
+ * [Data Clump](http://wiki.github.com/kevinrutherford/reek/data-clump)
55
+ * [Feature Envy](http://wiki.github.com/kevinrutherford/reek/feature-envy)
56
+ * [Large Class](http://wiki.github.com/kevinrutherford/reek/large-class)
57
+ * [Long Method](http://wiki.github.com/kevinrutherford/reek/long-method)
58
+ * [Long Parameter List](http://wiki.github.com/kevinrutherford/reek/long-parameter-list)
59
+ * [Simulated Polymorphism](http://wiki.github.com/kevinrutherford/reek/simulated-polymorphism)
60
+ * [Uncommunicative Name](http://wiki.github.com/kevinrutherford/reek/uncommunicative-name)
61
+
62
+ ...and more. See the [Reek wiki](http://wiki.github.com/kevinrutherford/reek/code-smells)
63
+ for up to date details of exactly what Reek will check in your code.
64
+
65
+ Tool Integration
66
+ ----------------
67
+
68
+ Reek integrates with many of your favourite tools:
69
+
70
+ * Use `Reek::Rake::Task` to easily add Reek to your Rakefile
71
+ * Use `Reek::Spec` to add the `should_not reek` custom matcher to your Rspec examples
72
+ * Reek is fully compliant with Ruby 1.8.6, 1.8.7 and 1.9.1
73
+
74
+ Dependencies
75
+ ------------
76
+
77
+ Reek makes use of the following other gems:
78
+
79
+ * ruby_parser
80
+ * sexp_processor
81
+ * ruby2ruby
82
+
83
+ Learn More
84
+ ----------
85
+
86
+ Find out more about Reek from any of the following sources:
87
+
88
+ * Browse the Reek documentation at [http://wiki.github.com/kevinrutherford/reek](http://wiki.github.com/kevinrutherford/reek)
89
+ * Browse the code or install the latest cutting-edge beta version from [http://github.com/kevinrutherford/reek/tree](http://github.com/kevinrutherford/reek/tree)
90
+ * Read the code API at [http://rdoc.info/projects/kevinrutherford/reek](http://rdoc.info/projects/kevinrutherford/reek)
data/bin/reek CHANGED
@@ -6,6 +6,6 @@
6
6
  # Author: Kevin Rutherford
7
7
  #
8
8
 
9
- require 'reek/adapters/application'
9
+ require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'lib', 'reek', 'cli', 'application')
10
10
 
11
- exit Reek::Application.new(ARGV).execute
11
+ exit Reek::Cli::Application.new(ARGV).execute
@@ -1,10 +1,28 @@
1
1
  ---
2
+ UncommunicativeParameterName:
3
+ accept:
4
+ - Inline::C
5
+ exclude: []
6
+
7
+ enabled: true
8
+ reject:
9
+ - !ruby/regexp /^.$/
10
+ - !ruby/regexp /[0-9]$/
2
11
  LargeClass:
3
12
  max_methods: 25
4
13
  exclude: []
5
14
 
6
15
  enabled: true
7
16
  max_instance_variables: 9
17
+ UncommunicativeMethodName:
18
+ accept: []
19
+
20
+ exclude: []
21
+
22
+ enabled: true
23
+ reject:
24
+ - !ruby/regexp /^.$/
25
+ - !ruby/regexp /[0-9]$/
8
26
  LongParameterList:
9
27
  max_params: 3
10
28
  exclude: []
@@ -20,7 +38,13 @@ FeatureEnvy:
20
38
  ClassVariable:
21
39
  exclude: *id001
22
40
  enabled: true
23
- UncommunicativeName:
41
+ BooleanParameter:
42
+ exclude: *id001
43
+ enabled: true
44
+ IrresponsibleModule:
45
+ exclude: *id001
46
+ enabled: true
47
+ UncommunicativeModuleName:
24
48
  accept:
25
49
  - Inline::C
26
50
  exclude: []
@@ -51,6 +75,15 @@ Attribute:
51
75
  exclude: []
52
76
 
53
77
  enabled: false
78
+ UncommunicativeVariableName:
79
+ accept:
80
+ - Inline::C
81
+ exclude: []
82
+
83
+ enabled: true
84
+ reject:
85
+ - !ruby/regexp /^.$/
86
+ - !ruby/regexp /[0-9]$/
54
87
  SimulatedPolymorphism:
55
88
  exclude: []
56
89
 
@@ -70,6 +103,3 @@ LongYieldList:
70
103
  exclude: []
71
104
 
72
105
  enabled: true
73
- overrides:
74
- initialize:
75
- max_params: 5
@@ -13,21 +13,41 @@ Feature: Masking smells using config files
13
13
  Dirty has the variable name '@s' (Uncommunicative Name)
14
14
  Dirty#a calls @s.title twice (Duplication)
15
15
  Dirty#a calls puts(@s.title) twice (Duplication)
16
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
16
17
  Dirty#a has the name 'a' (Uncommunicative Name)
17
- Dirty#a/block has the variable name 'x' (Uncommunicative Name)
18
- Dirty#a/block/block is nested (Nested Iterators)
18
+ Dirty#a has the variable name 'x' (Uncommunicative Name)
19
19
 
20
20
  """
21
21
 
22
22
  Scenario: corrupt config file prevents normal output
23
- When I run reek spec/samples/corrupt_config_file/dirty.rb
24
- Then the exit status indicates an error
25
- And it reports the error 'Error: Invalid configuration file "corrupt.reek" -- not a Hash'
23
+ When I run reek spec/samples/corrupt_config_file
24
+ Then the exit status indicates smells
25
+ And it reports:
26
+ """
27
+ spec/samples/corrupt_config_file/dirty.rb -- 7 warnings:
28
+ Dirty has no descriptive comment (Irresponsible Module)
29
+ Dirty has the variable name '@s' (Uncommunicative Name)
30
+ Dirty#a calls @s.title twice (Duplication)
31
+ Dirty#a calls puts(@s.title) twice (Duplication)
32
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
33
+ Dirty#a has the name 'a' (Uncommunicative Name)
34
+ Dirty#a has the variable name 'x' (Uncommunicative Name)
35
+
36
+ """
37
+ And it reports the error 'Error: Invalid configuration file "corrupt.reek" -- "This is not a config file" is not a code smell'
26
38
 
27
39
  Scenario: missing source file is an error
28
- When I run reek no_such_file.rb
29
- Then the exit status indicates an error
30
- And it reports the error "Error: No such file or directory - no_such_file.rb"
40
+ When I run reek no_such_file.rb spec/samples/masked/dirty.rb
41
+ Then the exit status indicates smells
42
+ And it reports:
43
+ """
44
+ spec/samples/masked/dirty.rb -- 3 warnings (+3 masked):
45
+ Dirty#a calls @s.title twice (Duplication)
46
+ Dirty#a calls puts(@s.title) twice (Duplication)
47
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
48
+
49
+ """
50
+ And it reports the error "Error: No such file - no_such_file.rb"
31
51
 
32
52
  Scenario: switch off one smell
33
53
  When I run reek spec/samples/masked/dirty.rb
@@ -37,7 +57,7 @@ Feature: Masking smells using config files
37
57
  spec/samples/masked/dirty.rb -- 3 warnings (+3 masked):
38
58
  Dirty#a calls @s.title twice (Duplication)
39
59
  Dirty#a calls puts(@s.title) twice (Duplication)
40
- Dirty#a/block/block is nested (Nested Iterators)
60
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
41
61
 
42
62
  """
43
63
 
@@ -50,9 +70,9 @@ Feature: Masking smells using config files
50
70
  (masked) Dirty has the variable name '@s' (Uncommunicative Name)
51
71
  Dirty#a calls @s.title twice (Duplication)
52
72
  Dirty#a calls puts(@s.title) twice (Duplication)
73
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
53
74
  (masked) Dirty#a has the name 'a' (Uncommunicative Name)
54
- (masked) Dirty#a/block has the variable name 'x' (Uncommunicative Name)
55
- Dirty#a/block/block is nested (Nested Iterators)
75
+ (masked) Dirty#a has the variable name 'x' (Uncommunicative Name)
56
76
 
57
77
  """
58
78
 
@@ -64,7 +84,7 @@ Feature: Masking smells using config files
64
84
  spec/samples/masked/dirty.rb -- 3 warnings (+3 masked):
65
85
  Dirty#a calls @s.title twice (Duplication)
66
86
  Dirty#a calls puts(@s.title) twice (Duplication)
67
- Dirty#a/block/block is nested (Nested Iterators)
87
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
68
88
 
69
89
  """
70
90
 
@@ -77,8 +97,8 @@ Feature: Masking smells using config files
77
97
  Dirty has the variable name '@s' (Uncommunicative Name)
78
98
  Dirty#a calls @s.title twice (Duplication)
79
99
  Dirty#a calls puts(@s.title) twice (Duplication)
100
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
80
101
  Dirty#a has the name 'a' (Uncommunicative Name)
81
- Dirty#a/block/block is nested (Nested Iterators)
82
102
 
83
103
  """
84
104
 
@@ -104,8 +124,8 @@ Feature: Masking smells using config files
104
124
  (masked) Dirty has the variable name '@s' (Uncommunicative Name)
105
125
  Dirty#a calls @s.title twice (Duplication)
106
126
  Dirty#a calls puts(@s.title) twice (Duplication)
127
+ (masked) Dirty#a contains iterators nested 2 deep (Nested Iterators)
107
128
  (masked) Dirty#a has the name 'a' (Uncommunicative Name)
108
- (masked) Dirty#a/block has the variable name 'x' (Uncommunicative Name)
109
- (masked) Dirty#a/block/block is nested (Nested Iterators)
129
+ (masked) Dirty#a has the variable name 'x' (Uncommunicative Name)
110
130
 
111
131
  """
@@ -8,6 +8,7 @@ Feature: Reek can be controlled using command-line options
8
8
  When I run reek --no-such-option
9
9
  Then the exit status indicates an error
10
10
  And it reports the error "Error: invalid option: --no-such-option"
11
+ And stdout equals ""
11
12
 
12
13
  Scenario: display the current version number
13
14
  When I run reek --version
@@ -37,5 +38,6 @@ Feature: Reek can be controlled using command-line options
37
38
  Report formatting:
38
39
  -a, --[no-]show-all Show all smells, including those masked by config settings
39
40
  -q, --[no-]quiet Suppress headings for smell-free source files
41
+ -y, --yaml Report smells in YAML format
40
42
 
41
43
  """
@@ -1,12 +1,12 @@
1
1
  @rake
2
- Feature: Reek can be driven through its RakeTask
2
+ Feature: Reek can be driven through its Task
3
3
  Reek provides an easy way to integrate its use into Rakefiles,
4
- via the RakeTask class. These scenarios test its various options.
4
+ via the Task class. These scenarios test its various options.
5
5
 
6
6
  Scenario: source_files points at the desired files
7
7
  When I run rake reek with:
8
8
  """
9
- Reek::RakeTask.new do |t|
9
+ Reek::Rake::Task.new do |t|
10
10
  t.source_files = 'spec/samples/masked/dirty.rb'
11
11
  end
12
12
  """
@@ -16,13 +16,13 @@ Feature: Reek can be driven through its RakeTask
16
16
  spec/samples/masked/dirty.rb -- 3 warnings (+3 masked):
17
17
  Dirty#a calls @s.title twice (Duplication)
18
18
  Dirty#a calls puts(@s.title) twice (Duplication)
19
- Dirty#a/block/block is nested (Nested Iterators)
19
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
20
20
  """
21
21
 
22
22
  Scenario: name changes the task name
23
23
  When I run rake silky with:
24
24
  """
25
- Reek::RakeTask.new('silky') do |t|
25
+ Reek::Rake::Task.new('silky') do |t|
26
26
  t.source_files = 'spec/samples/masked/dirty.rb'
27
27
  end
28
28
  """
@@ -32,31 +32,24 @@ Feature: Reek can be driven through its RakeTask
32
32
  spec/samples/masked/dirty.rb -- 3 warnings (+3 masked):
33
33
  Dirty#a calls @s.title twice (Duplication)
34
34
  Dirty#a calls puts(@s.title) twice (Duplication)
35
- Dirty#a/block/block is nested (Nested Iterators)
35
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
36
36
  """
37
37
 
38
38
  Scenario: verbose prints the reek command
39
39
  When I run rake reek with:
40
40
  """
41
- Reek::RakeTask.new do |t|
41
+ Reek::Rake::Task.new do |t|
42
42
  t.source_files = 'spec/samples/masked/dirty.rb'
43
43
  t.verbose = true
44
44
  end
45
45
  """
46
46
  Then the exit status indicates an error
47
- And it reports:
48
- """
49
- /usr/bin/ruby1.8 -I"/home/kevin/Working/git/reek/lib" "/home/kevin/Working/git/reek/bin/reek" "spec/samples/masked/dirty.rb"
50
- spec/samples/masked/dirty.rb -- 3 warnings (+3 masked):
51
- Dirty#a calls @s.title twice (Duplication)
52
- Dirty#a calls puts(@s.title) twice (Duplication)
53
- Dirty#a/block/block is nested (Nested Iterators)
54
- """
47
+ And stdout includes /spec\/samples\/masked\/dirty\.rb/
55
48
 
56
49
  Scenario: fail_on_error can hide the error status
57
50
  When I run rake reek with:
58
51
  """
59
- Reek::RakeTask.new do |t|
52
+ Reek::Rake::Task.new do |t|
60
53
  t.fail_on_error = false
61
54
  t.source_files = 'spec/samples/empty_config_file/dirty.rb'
62
55
  end
@@ -68,7 +61,7 @@ Feature: Reek can be driven through its RakeTask
68
61
  Dirty has the variable name '@s' (Uncommunicative Name)
69
62
  Dirty#a calls @s.title twice (Duplication)
70
63
  Dirty#a calls puts(@s.title) twice (Duplication)
64
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
71
65
  Dirty#a has the name 'a' (Uncommunicative Name)
72
- Dirty#a/block has the variable name 'x' (Uncommunicative Name)
73
- Dirty#a/block/block is nested (Nested Iterators)
66
+ Dirty#a has the variable name 'x' (Uncommunicative Name)
74
67
  """
@@ -13,16 +13,16 @@ Feature: Correctly formatted reports
13
13
  Dirty has the variable name '@s' (Uncommunicative Name)
14
14
  Dirty#a calls @s.title twice (Duplication)
15
15
  Dirty#a calls puts(@s.title) twice (Duplication)
16
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
16
17
  Dirty#a has the name 'a' (Uncommunicative Name)
17
- Dirty#a/block has the variable name 'x' (Uncommunicative Name)
18
- Dirty#a/block/block is nested (Nested Iterators)
18
+ Dirty#a has the variable name 'x' (Uncommunicative Name)
19
19
  spec/samples/two_smelly_files/dirty_two.rb -- 6 warnings:
20
20
  Dirty has the variable name '@s' (Uncommunicative Name)
21
21
  Dirty#a calls @s.title twice (Duplication)
22
22
  Dirty#a calls puts(@s.title) twice (Duplication)
23
+ Dirty#a contains iterators nested 2 deep (Nested Iterators)
23
24
  Dirty#a has the name 'a' (Uncommunicative Name)
24
- Dirty#a/block has the variable name 'x' (Uncommunicative Name)
25
- Dirty#a/block/block is nested (Nested Iterators)
25
+ Dirty#a has the variable name 'x' (Uncommunicative Name)
26
26
 
27
27
  """
28
28
 
@@ -50,11 +50,7 @@ Feature: Correctly formatted reports
50
50
  Scenario Outline: --quiet turns off headers for fragrant files
51
51
  When I run reek <option> spec/samples/three_clean_files/*.rb
52
52
  Then it succeeds
53
- And it reports:
54
- """
55
-
56
-
57
- """
53
+ And stdout equals ""
58
54
 
59
55
  Examples:
60
56
  | option |
@@ -67,20 +63,22 @@ Feature: Correctly formatted reports
67
63
  Then it succeeds
68
64
  And it reports:
69
65
  """
70
- spec/samples/clean_due_to_masking/dirty_one.rb -- 0 warnings (+6 masked):
66
+ spec/samples/clean_due_to_masking/dirty_one.rb -- 0 warnings (+7 masked):
67
+ (masked) Dirty has no descriptive comment (Irresponsible Module)
71
68
  (masked) Dirty has the variable name '@s' (Uncommunicative Name)
72
69
  (masked) Dirty#a calls @s.title twice (Duplication)
73
70
  (masked) Dirty#a calls puts(@s.title) twice (Duplication)
71
+ (masked) Dirty#a contains iterators nested 2 deep (Nested Iterators)
74
72
  (masked) Dirty#a has the name 'a' (Uncommunicative Name)
75
- (masked) Dirty#a/block has the variable name 'x' (Uncommunicative Name)
76
- (masked) Dirty#a/block/block is nested (Nested Iterators)
77
- spec/samples/clean_due_to_masking/dirty_two.rb -- 0 warnings (+6 masked):
73
+ (masked) Dirty#a has the variable name 'x' (Uncommunicative Name)
74
+ spec/samples/clean_due_to_masking/dirty_two.rb -- 0 warnings (+7 masked):
75
+ (masked) Dirty has no descriptive comment (Irresponsible Module)
78
76
  (masked) Dirty has the variable name '@s' (Uncommunicative Name)
79
77
  (masked) Dirty#a calls @s.title twice (Duplication)
80
78
  (masked) Dirty#a calls puts(@s.title) twice (Duplication)
79
+ (masked) Dirty#a contains iterators nested 2 deep (Nested Iterators)
81
80
  (masked) Dirty#a has the name 'a' (Uncommunicative Name)
82
- (masked) Dirty#a/block has the variable name 'x' (Uncommunicative Name)
83
- (masked) Dirty#a/block/block is nested (Nested Iterators)
81
+ (masked) Dirty#a has the variable name 'x' (Uncommunicative Name)
84
82
 
85
83
  """
86
84