reek 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +10 -0
- data/History.txt +20 -0
- data/README.md +90 -0
- data/bin/reek +2 -2
- data/config/defaults.reek +34 -4
- data/features/masking_smells.feature +35 -15
- data/features/options.feature +2 -0
- data/features/rake_task.feature +11 -18
- data/features/reports.feature +13 -15
- data/features/samples.feature +90 -105
- data/features/stdin.feature +3 -6
- data/features/step_definitions/reek_steps.rb +8 -4
- data/features/support/env.rb +2 -3
- data/features/yaml.feature +124 -0
- data/lib/reek.rb +8 -4
- data/lib/reek/cli/application.rb +46 -0
- data/lib/reek/cli/command_line.rb +106 -0
- data/lib/reek/cli/help_command.rb +18 -0
- data/lib/reek/cli/reek_command.rb +37 -0
- data/lib/reek/cli/report.rb +91 -0
- data/lib/reek/cli/version_command.rb +19 -0
- data/lib/reek/cli/yaml_command.rb +32 -0
- data/lib/reek/core/block_context.rb +18 -0
- data/lib/reek/core/class_context.rb +23 -0
- data/lib/reek/core/code_context.rb +72 -0
- data/lib/reek/core/code_parser.rb +192 -0
- data/lib/reek/core/detector_stack.rb +29 -0
- data/lib/reek/core/masking_collection.rb +46 -0
- data/lib/reek/core/method_context.rb +132 -0
- data/lib/reek/core/module_context.rb +64 -0
- data/lib/reek/{object_refs.rb → core/object_refs.rb} +8 -6
- data/lib/reek/{singleton_method_context.rb → core/singleton_method_context.rb} +10 -5
- data/lib/reek/core/smell_configuration.rb +66 -0
- data/lib/reek/core/sniffer.rb +110 -0
- data/lib/reek/core/stop_context.rb +26 -0
- data/lib/reek/examiner.rb +88 -0
- data/lib/reek/rake/task.rb +124 -0
- data/lib/reek/smell_warning.rb +69 -13
- data/lib/reek/smells.rb +29 -0
- data/lib/reek/smells/attribute.rb +13 -14
- data/lib/reek/smells/boolean_parameter.rb +33 -0
- data/lib/reek/smells/class_variable.rb +8 -6
- data/lib/reek/smells/control_couple.rb +33 -17
- data/lib/reek/smells/data_clump.rb +10 -6
- data/lib/reek/smells/duplication.rb +24 -14
- data/lib/reek/smells/feature_envy.rb +11 -6
- data/lib/reek/smells/irresponsible_module.rb +28 -0
- data/lib/reek/smells/large_class.rb +9 -7
- data/lib/reek/smells/long_method.rb +6 -5
- data/lib/reek/smells/long_parameter_list.rb +11 -9
- data/lib/reek/smells/long_yield_list.rb +37 -7
- data/lib/reek/smells/nested_iterators.rb +34 -9
- data/lib/reek/smells/simulated_polymorphism.rb +15 -11
- data/lib/reek/smells/smell_detector.rb +24 -12
- data/lib/reek/smells/uncommunicative_method_name.rb +76 -0
- data/lib/reek/smells/uncommunicative_module_name.rb +76 -0
- data/lib/reek/smells/{uncommunicative_name.rb → uncommunicative_parameter_name.rb} +14 -26
- data/lib/reek/smells/uncommunicative_variable_name.rb +90 -0
- data/lib/reek/smells/utility_function.rb +33 -9
- data/lib/reek/source.rb +18 -0
- data/lib/reek/source/code_comment.rb +19 -0
- data/lib/reek/source/config_file.rb +72 -0
- data/lib/reek/source/core_extras.rb +46 -0
- data/lib/reek/source/sexp_formatter.rb +16 -0
- data/lib/reek/source/source_code.rb +44 -0
- data/lib/reek/source/source_file.rb +32 -0
- data/lib/reek/source/source_locator.rb +36 -0
- data/lib/reek/source/tree_dresser.rb +128 -0
- data/lib/reek/spec.rb +51 -0
- data/lib/reek/spec/should_reek.rb +34 -0
- data/lib/reek/spec/should_reek_of.rb +37 -0
- data/lib/reek/spec/should_reek_only_of.rb +36 -0
- data/reek.gemspec +5 -5
- data/spec/reek/{help_command_spec.rb → cli/help_command_spec.rb} +3 -4
- data/spec/reek/{reek_command_spec.rb → cli/reek_command_spec.rb} +8 -7
- data/spec/reek/cli/report_spec.rb +26 -0
- data/spec/reek/{version_command_spec.rb → cli/version_command_spec.rb} +3 -3
- data/spec/reek/cli/yaml_command_spec.rb +47 -0
- data/spec/reek/core/block_context_spec.rb +26 -0
- data/spec/reek/core/class_context_spec.rb +53 -0
- data/spec/reek/{code_context_spec.rb → core/code_context_spec.rb} +15 -37
- data/spec/reek/{code_parser_spec.rb → core/code_parser_spec.rb} +5 -5
- data/spec/reek/{config_spec.rb → core/config_spec.rb} +2 -6
- data/spec/reek/{masking_collection_spec.rb → core/masking_collection_spec.rb} +3 -4
- data/spec/reek/{method_context_spec.rb → core/method_context_spec.rb} +6 -7
- data/spec/reek/core/module_context_spec.rb +42 -0
- data/spec/reek/{object_refs_spec.rb → core/object_refs_spec.rb} +5 -6
- data/spec/reek/core/singleton_method_context_spec.rb +15 -0
- data/spec/reek/core/smell_configuration_spec.rb +11 -0
- data/spec/reek/core/stop_context_spec.rb +17 -0
- data/spec/reek/examiner_spec.rb +42 -0
- data/spec/reek/smell_warning_spec.rb +82 -33
- data/spec/reek/smells/attribute_spec.rb +33 -7
- data/spec/reek/smells/boolean_parameter_spec.rb +76 -0
- data/spec/reek/smells/class_variable_spec.rb +15 -6
- data/spec/reek/smells/control_couple_spec.rb +40 -29
- data/spec/reek/smells/data_clump_spec.rb +28 -7
- data/spec/reek/smells/duplication_spec.rb +47 -41
- data/spec/reek/smells/feature_envy_spec.rb +76 -18
- data/spec/reek/smells/irresponsible_module_spec.rb +37 -0
- data/spec/reek/smells/large_class_spec.rb +91 -56
- data/spec/reek/smells/long_method_spec.rb +32 -7
- data/spec/reek/smells/long_parameter_list_spec.rb +42 -13
- data/spec/reek/smells/long_yield_list_spec.rb +65 -0
- data/spec/reek/smells/nested_iterators_spec.rb +94 -3
- data/spec/reek/smells/simulated_polymorphism_spec.rb +48 -20
- data/spec/reek/smells/smell_detector_shared.rb +28 -0
- data/spec/reek/smells/uncommunicative_method_name_spec.rb +57 -0
- data/spec/reek/smells/uncommunicative_module_name_spec.rb +67 -0
- data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +61 -0
- data/spec/reek/smells/uncommunicative_variable_name_spec.rb +124 -0
- data/spec/reek/smells/utility_function_spec.rb +45 -3
- data/spec/reek/source/code_comment_spec.rb +24 -0
- data/spec/reek/source/object_source_spec.rb +20 -0
- data/spec/reek/{adapters/source_spec.rb → source/source_code_spec.rb} +7 -8
- data/spec/reek/source/tree_dresser_spec.rb +165 -0
- data/spec/reek/spec/should_reek_of_spec.rb +76 -0
- data/spec/reek/spec/should_reek_only_of_spec.rb +89 -0
- data/spec/reek/{adapters → spec}/should_reek_spec.rb +8 -32
- data/spec/samples/all_but_one_masked/clean_one.rb +1 -0
- data/spec/samples/all_but_one_masked/dirty.rb +1 -0
- data/spec/samples/all_but_one_masked/masked.reek +5 -1
- data/spec/samples/clean_due_to_masking/clean_one.rb +1 -0
- data/spec/samples/clean_due_to_masking/clean_three.rb +1 -0
- data/spec/samples/clean_due_to_masking/clean_two.rb +1 -0
- data/spec/samples/clean_due_to_masking/dirty_one.rb +1 -1
- data/spec/samples/clean_due_to_masking/dirty_two.rb +1 -1
- data/spec/samples/clean_due_to_masking/masked.reek +5 -1
- data/spec/samples/corrupt_config_file/dirty.rb +1 -1
- data/spec/samples/empty_config_file/dirty.rb +2 -1
- data/spec/samples/exceptions.reek +1 -1
- data/spec/samples/masked/dirty.rb +2 -1
- data/spec/samples/masked/masked.reek +3 -1
- data/spec/samples/mixed_results/clean_one.rb +1 -0
- data/spec/samples/mixed_results/clean_three.rb +1 -0
- data/spec/samples/mixed_results/clean_two.rb +1 -0
- data/spec/samples/mixed_results/dirty_one.rb +1 -0
- data/spec/samples/mixed_results/dirty_two.rb +1 -0
- data/spec/samples/not_quite_masked/dirty.rb +2 -1
- data/spec/samples/not_quite_masked/masked.reek +1 -1
- data/spec/samples/overrides/masked/dirty.rb +2 -1
- data/spec/samples/overrides/masked/lower.reek +3 -1
- data/spec/samples/three_clean_files/clean_one.rb +1 -0
- data/spec/samples/three_clean_files/clean_three.rb +1 -0
- data/spec/samples/three_clean_files/clean_two.rb +1 -0
- data/spec/samples/two_smelly_files/dirty_one.rb +2 -1
- data/spec/samples/two_smelly_files/dirty_two.rb +2 -1
- data/spec/spec_helper.rb +1 -2
- data/tasks/reek.rake +2 -2
- data/tasks/test.rake +12 -3
- metadata +81 -62
- data/README.rdoc +0 -84
- data/lib/reek/adapters/application.rb +0 -46
- data/lib/reek/adapters/command_line.rb +0 -77
- data/lib/reek/adapters/config_file.rb +0 -31
- data/lib/reek/adapters/core_extras.rb +0 -64
- data/lib/reek/adapters/rake_task.rb +0 -121
- data/lib/reek/adapters/report.rb +0 -86
- data/lib/reek/adapters/source.rb +0 -72
- data/lib/reek/adapters/spec.rb +0 -133
- data/lib/reek/block_context.rb +0 -62
- data/lib/reek/class_context.rb +0 -41
- data/lib/reek/code_context.rb +0 -68
- data/lib/reek/code_parser.rb +0 -203
- data/lib/reek/configuration.rb +0 -57
- data/lib/reek/detector_stack.rb +0 -37
- data/lib/reek/help_command.rb +0 -14
- data/lib/reek/if_context.rb +0 -18
- data/lib/reek/masking_collection.rb +0 -33
- data/lib/reek/method_context.rb +0 -138
- data/lib/reek/module_context.rb +0 -49
- data/lib/reek/name.rb +0 -57
- data/lib/reek/reek_command.rb +0 -28
- data/lib/reek/sexp_formatter.rb +0 -10
- data/lib/reek/sniffer.rb +0 -177
- data/lib/reek/stop_context.rb +0 -35
- data/lib/reek/tree_dresser.rb +0 -82
- data/lib/reek/version_command.rb +0 -14
- data/lib/reek/yield_call_context.rb +0 -12
- data/spec/reek/adapters/report_spec.rb +0 -31
- data/spec/reek/adapters/should_reek_of_spec.rb +0 -138
- data/spec/reek/adapters/should_reek_only_of_spec.rb +0 -87
- data/spec/reek/block_context_spec.rb +0 -65
- data/spec/reek/class_context_spec.rb +0 -161
- data/spec/reek/configuration_spec.rb +0 -12
- data/spec/reek/if_context_spec.rb +0 -17
- data/spec/reek/module_context_spec.rb +0 -46
- data/spec/reek/name_spec.rb +0 -37
- data/spec/reek/object_source_spec.rb +0 -23
- data/spec/reek/singleton_method_context_spec.rb +0 -16
- data/spec/reek/smells/smell_detector_spec.rb +0 -36
- data/spec/reek/smells/uncommunicative_name_spec.rb +0 -146
- data/spec/reek/sniffer_spec.rb +0 -11
- data/spec/reek/stop_context_spec.rb +0 -33
- data/spec/reek/tree_dresser_spec.rb +0 -20
data/.yardopts
ADDED
data/History.txt
CHANGED
@@ -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
|
data/README.md
ADDED
@@ -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
|
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
|
data/config/defaults.reek
CHANGED
@@ -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
|
-
|
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
|
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
|
24
|
-
Then the exit status indicates
|
25
|
-
And it reports
|
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
|
30
|
-
And it reports
|
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
|
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
|
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
|
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
|
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
|
"""
|
data/features/options.feature
CHANGED
@@ -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
|
"""
|
data/features/rake_task.feature
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
@rake
|
2
|
-
Feature: Reek can be driven through its
|
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
|
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::
|
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
|
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::
|
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
|
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::
|
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
|
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::
|
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
|
73
|
-
Dirty#a/block/block is nested (Nested Iterators)
|
66
|
+
Dirty#a has the variable name 'x' (Uncommunicative Name)
|
74
67
|
"""
|
data/features/reports.feature
CHANGED
@@ -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
|
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
|
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
|
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 (+
|
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
|
76
|
-
|
77
|
-
|
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
|
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
|
|