reek 1.2.8 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/History.txt +4 -0
  2. data/README.md +40 -25
  3. data/Rakefile +2 -15
  4. data/bin/reek +1 -1
  5. data/features/{options.feature → command_line_interface/options.feature} +1 -3
  6. data/features/{stdin.feature → command_line_interface/stdin.feature} +2 -2
  7. data/features/{masking_smells.feature → configuration_files/masking_smells.feature} +23 -23
  8. data/features/{rake_task.feature → rake_task/rake_task.feature} +9 -9
  9. data/features/{reports.feature → reports/reports.feature} +10 -10
  10. data/features/{yaml.feature → reports/yaml.feature} +2 -2
  11. data/features/{api.feature → ruby_api/api.feature} +6 -6
  12. data/features/samples.feature +239 -247
  13. data/features/step_definitions/reek_steps.rb +15 -1
  14. data/features/support/env.rb +0 -1
  15. data/lib/reek.rb +1 -4
  16. data/lib/reek/cli/command_line.rb +6 -5
  17. data/lib/reek/cli/report.rb +1 -1
  18. data/lib/reek/core/hash_extensions.rb +29 -0
  19. data/lib/reek/core/method_context.rb +3 -16
  20. data/lib/reek/core/object_refs.rb +5 -22
  21. data/lib/reek/core/smell_repository.rb +65 -0
  22. data/lib/reek/core/sniffer.rb +7 -76
  23. data/lib/reek/core/warning_collector.rb +1 -5
  24. data/lib/reek/examiner.rb +3 -13
  25. data/lib/reek/rake/task.rb +10 -2
  26. data/lib/reek/smell_warning.rb +1 -0
  27. data/lib/reek/smells/smell_detector.rb +0 -3
  28. data/lib/reek/smells/uncommunicative_module_name.rb +6 -3
  29. data/lib/reek/smells/uncommunicative_variable_name.rb +1 -1
  30. data/lib/reek/source/config_file.rb +8 -2
  31. data/lib/reek/source/sexp_formatter.rb +1 -1
  32. data/lib/reek/source/source_repository.rb +31 -0
  33. data/lib/reek/source/tree_dresser.rb +1 -1
  34. data/lib/reek/spec/should_reek.rb +5 -2
  35. data/lib/reek/version.rb +3 -0
  36. data/lib/xp.reek +63 -0
  37. data/reek.gemspec +16 -28
  38. data/spec/gem/manifest_spec.rb +22 -0
  39. data/spec/gem/updates_spec.rb +26 -0
  40. data/spec/gem/yard_spec.rb +15 -0
  41. data/spec/matchers/smell_of_matcher.rb +0 -1
  42. data/spec/reek/cli/reek_command_spec.rb +1 -1
  43. data/spec/reek/core/method_context_spec.rb +2 -2
  44. data/spec/reek/core/object_refs_spec.rb +115 -118
  45. data/spec/reek/smell_warning_spec.rb +2 -2
  46. data/spec/reek/smells/uncommunicative_variable_name_spec.rb +3 -0
  47. data/spec/reek/source/sexp_formatter_spec.rb +19 -0
  48. data/spec/reek/spec/should_reek_spec.rb +21 -3
  49. data/tasks/deployment.rake +69 -0
  50. data/tasks/develop.rake +29 -0
  51. data/tasks/test.rake +1 -6
  52. metadata +200 -138
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == Unpublished
2
+
3
+ * (marktabler) Allow single underscore as a variable assignment without triggering UncommunicativeVariableName.
4
+
1
5
  == 1.2.8 (2010-04-26)
2
6
 
3
7
  === Major Changes
data/README.md CHANGED
@@ -1,50 +1,62 @@
1
1
  # Reek -- code smell detection for Ruby
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/troessner/reek.png?branch=master)](http://travis-ci.org/troessner/reek?branch=master)
4
+
3
5
  Reek is a tool that examines Ruby classes, modules and methods and
4
6
  reports any code smells it finds. Install it like this:
5
7
 
6
- $ gem install reek
8
+ ```bash
9
+ $ gem install reek
10
+ ```
7
11
 
8
12
  and run it like this:
9
13
 
10
- $ reek [options] [dir_or_source_file]*
14
+ ```bash
15
+ $ reek [options] [dir_or_source_file]*
16
+ ```
11
17
 
12
18
  For a full list of command-line options see the Reek
13
- wiki[http://wiki.github.com/kevinrutherford/reek/command-line-options]
19
+ wiki[http://wiki.github.com/troessner/reek/command-line-options]
14
20
  or run
15
21
 
16
- $ reek --help
22
+ ```bash
23
+ $ reek --help
24
+ ```
17
25
 
18
26
  ## Example
19
27
 
20
28
  Imagine a source file <tt>demo.rb</tt> containing:
21
29
 
22
- class Dirty
23
- # This method smells of :reek:NestedIterators but ignores them
24
- def awful(x, y, offset = 0, log = false)
25
- puts @screen.title
26
- @screen = widgets.map {|w| w.each {|key| key += 3}}
27
- puts @screen.contents
28
- end
29
- end
30
+ ```ruby
31
+ class Dirty
32
+ # This method smells of :reek:NestedIterators but ignores them
33
+ def awful(x, y, offset = 0, log = false)
34
+ puts @screen.title
35
+ @screen = widgets.map {|w| w.each {|key| key += 3}}
36
+ puts @screen.contents
37
+ end
38
+ end
39
+ ```
30
40
 
31
41
  Reek will report the following code smells in this file:
32
42
 
33
- $ reek demo.rb
34
- spec/samples/demo/demo.rb -- 6 warnings:
35
- Dirty has no descriptive comment (IrresponsibleModule)
36
- Dirty#awful has 4 parameters (LongParameterList)
37
- Dirty#awful has boolean parameter 'log' (ControlCouple)
38
- Dirty#awful has the parameter name 'x' (UncommunicativeName)
39
- Dirty#awful has the parameter name 'y' (UncommunicativeName)
40
- Dirty#awful has the variable name 'w' (UncommunicativeName)
43
+ ```bash
44
+ $ reek demo.rb
45
+ spec/samples/demo/demo.rb -- 6 warnings:
46
+ Dirty has no descriptive comment (IrresponsibleModule)
47
+ Dirty#awful has 4 parameters (LongParameterList)
48
+ Dirty#awful has boolean parameter 'log' (ControlCouple)
49
+ Dirty#awful has the parameter name 'x' (UncommunicativeName)
50
+ Dirty#awful has the parameter name 'y' (UncommunicativeName)
51
+ Dirty#awful has the variable name 'w' (UncommunicativeName)
52
+ ```
41
53
 
42
54
  ## Features
43
55
 
44
56
  Reek currently includes checks for some aspects of Control Couple,
45
57
  Data Clump, Feature Envy, Large Class, Long Method, Long Parameter List,
46
58
  Simulated Polymorphism, Uncommunicative Name and more.
47
- See the [Reek wiki](http://wiki.github.com/kevinrutherford/reek/code-smells)
59
+ See the [Reek wiki](http://wiki.github.com/troessner/reek/code-smells)
48
60
  for up to date details of exactly what Reek will check in your code.
49
61
 
50
62
  ### Tool Integration
@@ -53,7 +65,9 @@ Reek integrates with many of your favourite tools:
53
65
 
54
66
  * `require 'reek/rake/task'` to easily add Reek to your Rakefile
55
67
  * `require 'reek/spec'` to add the `should_not reek` custom matcher to your Rspec examples
56
- * Reek is fully compliant with Ruby 1.8.6, 1.8.7 and 1.9.1
68
+ * Reek is compatible with Ruby 1.8.6, 1.8.7, 1.9.2 and 1.9.3
69
+
70
+ At present Reek is unable to parse the new Ruby 1.9 hash syntax of {a: 1}.
57
71
 
58
72
  ### Dependencies
59
73
 
@@ -68,7 +82,8 @@ Learn More
68
82
 
69
83
  Find out more about Reek from any of the following sources:
70
84
 
71
- * Browse the Reek documentation at [http://wiki.github.com/kevinrutherford/reek](http://wiki.github.com/kevinrutherford/reek)
72
- * Browse the code or install the latest development version from [http://github.com/kevinrutherford/reek/tree](http://github.com/kevinrutherford/reek/tree)
73
- * Read the code API at [http://rdoc.info/projects/kevinrutherford/reek](http://rdoc.info/projects/kevinrutherford/reek)
85
+ * Browse the Reek documentation at [http://wiki.github.com/troessner/reek](http://wiki.github.com/troessner/reek)
86
+ * Browse the code or install the latest development version from [http://github.com/troessner/reek/tree](http://github.com/troessner/reek/tree)
87
+ * Read the code API at [http://rdoc.info/projects/troessner/reek](http://rdoc.info/projects/troessner/reek)
74
88
  * Follow [@rubyreek](http://twitter.com/rubyreek) on twitter!
89
+
data/Rakefile CHANGED
@@ -1,15 +1,2 @@
1
- require 'rake/clean'
2
-
3
- $:.unshift File.dirname(__FILE__) + '/lib'
4
-
5
- PROJECT_NAME = 'reek'
6
-
7
- BUILD_DIR = 'build'; directory BUILD_DIR
8
- PKG_DIR = "#{BUILD_DIR}/pkg"; directory PKG_DIR
9
-
10
- GEM_MANIFEST = "Manifest.txt"
11
- VERSION_FILE = 'lib/reek.rb'
12
-
13
- CLOBBER.include("#{BUILD_DIR}/*")
14
-
15
- Dir['tasks/**/*.rake'].each { |t| load t }
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/reek CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
3
  # Reek examines Ruby source code for smells.
4
- # Visit http://wiki.github.com/kevinrutherford/reek for docs etc.
4
+ # Visit http://wiki.github.com/troessner/reek for docs etc.
5
5
  #
6
6
  # Author: Kevin Rutherford
7
7
  #
@@ -28,17 +28,15 @@ Feature: Reek can be controlled using command-line options
28
28
  reek -q lib
29
29
  cat my_class.rb | reek
30
30
 
31
- See http://wiki.github.com/kevinrutherford/reek for detailed help.
31
+ See http://wiki.github.com/troessner/reek for detailed help.
32
32
 
33
33
  Common options:
34
34
  -h, --help Show this message
35
35
  -v, --version Show version
36
36
 
37
-
38
37
  Configuration:
39
38
  -c, --config FILE Read configuration options from FILE
40
39
 
41
-
42
40
  Report formatting:
43
41
  -q, --[no-]quiet Suppress headings for smell-free source files
44
42
  -y, --yaml Report smells in YAML format
@@ -34,8 +34,8 @@ Feature: Reek reads from $stdin when no files are given
34
34
  """
35
35
  $stdin -- 3 warnings:
36
36
  Turn has no descriptive comment (IrresponsibleModule)
37
- Turn has the variable name '@x' (UncommunicativeName)
38
- Turn#y has the name 'y' (UncommunicativeName)
37
+ Turn has the variable name '@x' (UncommunicativeVariableName)
38
+ Turn#y has the name 'y' (UncommunicativeMethodName)
39
39
 
40
40
  """
41
41
 
@@ -10,12 +10,12 @@ Feature: Masking smells using config files
10
10
  And it reports:
11
11
  """
12
12
  spec/samples/empty_config_file/dirty.rb -- 6 warnings:
13
- Dirty has the variable name '@s' (UncommunicativeName)
14
- Dirty#a calls @s.title twice (Duplication)
15
- Dirty#a calls puts(@s.title) twice (Duplication)
13
+ Dirty has the variable name '@s' (UncommunicativeVariableName)
14
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
15
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
16
16
  Dirty#a contains iterators nested 2 deep (NestedIterators)
17
- Dirty#a has the name 'a' (UncommunicativeName)
18
- Dirty#a has the variable name 'x' (UncommunicativeName)
17
+ Dirty#a has the name 'a' (UncommunicativeMethodName)
18
+ Dirty#a has the variable name 'x' (UncommunicativeVariableName)
19
19
 
20
20
  """
21
21
 
@@ -26,15 +26,15 @@ Feature: Masking smells using config files
26
26
  """
27
27
  spec/samples/corrupt_config_file/dirty.rb -- 7 warnings:
28
28
  Dirty has no descriptive comment (IrresponsibleModule)
29
- Dirty has the variable name '@s' (UncommunicativeName)
30
- Dirty#a calls @s.title twice (Duplication)
31
- Dirty#a calls puts(@s.title) twice (Duplication)
29
+ Dirty has the variable name '@s' (UncommunicativeVariableName)
30
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
31
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
32
32
  Dirty#a contains iterators nested 2 deep (NestedIterators)
33
- Dirty#a has the name 'a' (UncommunicativeName)
34
- Dirty#a has the variable name 'x' (UncommunicativeName)
33
+ Dirty#a has the name 'a' (UncommunicativeMethodName)
34
+ Dirty#a has the variable name 'x' (UncommunicativeVariableName)
35
35
 
36
36
  """
37
- And it reports the error 'Error: Invalid configuration file "corrupt.reek" -- "This is not a config file" is not a code smell'
37
+ And it reports an error
38
38
 
39
39
  Scenario: missing source file is an error
40
40
  When I run reek no_such_file.rb spec/samples/masked/dirty.rb
@@ -42,8 +42,8 @@ Feature: Masking smells using config files
42
42
  And it reports:
43
43
  """
44
44
  spec/samples/masked/dirty.rb -- 3 warnings:
45
- Dirty#a calls @s.title twice (Duplication)
46
- Dirty#a calls puts(@s.title) twice (Duplication)
45
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
46
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
47
47
  Dirty#a contains iterators nested 2 deep (NestedIterators)
48
48
 
49
49
  """
@@ -55,8 +55,8 @@ Feature: Masking smells using config files
55
55
  And it reports:
56
56
  """
57
57
  spec/samples/masked/dirty.rb -- 3 warnings:
58
- Dirty#a calls @s.title twice (Duplication)
59
- Dirty#a calls puts(@s.title) twice (Duplication)
58
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
59
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
60
60
  Dirty#a contains iterators nested 2 deep (NestedIterators)
61
61
 
62
62
  """
@@ -67,11 +67,11 @@ Feature: Masking smells using config files
67
67
  And it reports:
68
68
  """
69
69
  spec/samples/not_quite_masked/dirty.rb -- 5 warnings:
70
- Dirty has the variable name '@s' (UncommunicativeName)
71
- Dirty#a calls @s.title twice (Duplication)
72
- Dirty#a calls puts(@s.title) twice (Duplication)
70
+ Dirty has the variable name '@s' (UncommunicativeVariableName)
71
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
72
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
73
73
  Dirty#a contains iterators nested 2 deep (NestedIterators)
74
- Dirty#a has the name 'a' (UncommunicativeName)
74
+ Dirty#a has the name 'a' (UncommunicativeMethodName)
75
75
 
76
76
  """
77
77
 
@@ -82,8 +82,8 @@ Feature: Masking smells using config files
82
82
  And it reports:
83
83
  """
84
84
  spec/samples/overrides/masked/dirty.rb -- 2 warnings:
85
- Dirty#a calls @s.title twice (Duplication)
86
- Dirty#a calls puts(@s.title) twice (Duplication)
85
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
86
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
87
87
 
88
88
  """
89
89
 
@@ -93,7 +93,7 @@ Feature: Masking smells using config files
93
93
  And it reports:
94
94
  """
95
95
  spec/samples/mask_some/dirty.rb -- 2 warnings:
96
- Dirty#a calls @s.title twice (Duplication)
96
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
97
97
  Dirty#a contains iterators nested 2 deep (NestedIterators)
98
98
 
99
99
  """
@@ -105,7 +105,7 @@ Feature: Masking smells using config files
105
105
  And it reports:
106
106
  """
107
107
  spec/samples/inline_config/dirty.rb -- 1 warning:
108
- Dirty#a calls @s.title twice (Duplication)
108
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
109
109
 
110
110
  """
111
111
 
@@ -14,8 +14,8 @@ Feature: Reek can be driven through its Task
14
14
  And it reports:
15
15
  """
16
16
  spec/samples/masked/dirty.rb -- 3 warnings:
17
- Dirty#a calls @s.title twice (Duplication)
18
- Dirty#a calls puts(@s.title) twice (Duplication)
17
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
18
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
19
19
  Dirty#a contains iterators nested 2 deep (NestedIterators)
20
20
  """
21
21
 
@@ -30,8 +30,8 @@ Feature: Reek can be driven through its Task
30
30
  And it reports:
31
31
  """
32
32
  spec/samples/masked/dirty.rb -- 3 warnings:
33
- Dirty#a calls @s.title twice (Duplication)
34
- Dirty#a calls puts(@s.title) twice (Duplication)
33
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
34
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
35
35
  Dirty#a contains iterators nested 2 deep (NestedIterators)
36
36
  """
37
37
 
@@ -58,12 +58,12 @@ Feature: Reek can be driven through its Task
58
58
  And it reports:
59
59
  """
60
60
  spec/samples/empty_config_file/dirty.rb -- 6 warnings:
61
- Dirty has the variable name '@s' (UncommunicativeName)
62
- Dirty#a calls @s.title twice (Duplication)
63
- Dirty#a calls puts(@s.title) twice (Duplication)
61
+ Dirty has the variable name '@s' (UncommunicativeVariableName)
62
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
63
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
64
64
  Dirty#a contains iterators nested 2 deep (NestedIterators)
65
- Dirty#a has the name 'a' (UncommunicativeName)
66
- Dirty#a has the variable name 'x' (UncommunicativeName)
65
+ Dirty#a has the name 'a' (UncommunicativeMethodName)
66
+ Dirty#a has the variable name 'x' (UncommunicativeVariableName)
67
67
  """
68
68
 
69
69
  Scenario: can be configured with config_files
@@ -10,19 +10,19 @@ Feature: Correctly formatted reports
10
10
  And it reports:
11
11
  """
12
12
  spec/samples/two_smelly_files/dirty_one.rb -- 6 warnings:
13
- Dirty has the variable name '@s' (UncommunicativeName)
14
- Dirty#a calls @s.title twice (Duplication)
15
- Dirty#a calls puts(@s.title) twice (Duplication)
13
+ Dirty has the variable name '@s' (UncommunicativeVariableName)
14
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
15
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
16
16
  Dirty#a contains iterators nested 2 deep (NestedIterators)
17
- Dirty#a has the name 'a' (UncommunicativeName)
18
- Dirty#a has the variable name 'x' (UncommunicativeName)
17
+ Dirty#a has the name 'a' (UncommunicativeMethodName)
18
+ Dirty#a has the variable name 'x' (UncommunicativeVariableName)
19
19
  spec/samples/two_smelly_files/dirty_two.rb -- 6 warnings:
20
- Dirty has the variable name '@s' (UncommunicativeName)
21
- Dirty#a calls @s.title twice (Duplication)
22
- Dirty#a calls puts(@s.title) twice (Duplication)
20
+ Dirty has the variable name '@s' (UncommunicativeVariableName)
21
+ Dirty#a calls @s.title twice (DuplicateMethodCall)
22
+ Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
23
23
  Dirty#a contains iterators nested 2 deep (NestedIterators)
24
- Dirty#a has the name 'a' (UncommunicativeName)
25
- Dirty#a has the variable name 'x' (UncommunicativeName)
24
+ Dirty#a has the name 'a' (UncommunicativeMethodName)
25
+ Dirty#a has the variable name 'x' (UncommunicativeVariableName)
26
26
 
27
27
  """
28
28
 
@@ -12,7 +12,7 @@ Feature: Report smells using simple YAML layout
12
12
  Scenario: masked smells always appear
13
13
  When I run reek --yaml spec/samples/masked/dirty.rb
14
14
  Then the exit status indicates smells
15
- And it reports:
15
+ And it reports this yaml:
16
16
  """
17
17
  ---
18
18
  - !ruby/object:Reek::SmellWarning
@@ -65,7 +65,7 @@ Feature: Report smells using simple YAML layout
65
65
  Scenario: return non-zero status when there are smells
66
66
  When I pass "class Turn; end" to reek --yaml
67
67
  Then the exit status indicates smells
68
- And it reports:
68
+ And it reports this yaml:
69
69
  """
70
70
  ---
71
71
  - !ruby/object:Reek::SmellWarning
@@ -1,8 +1,8 @@
1
1
  @masking
2
2
  Feature: The Reek API maintains backwards compatibility
3
- In order to use Reek witthout fuss
3
+ In order to use Reek without fuss
4
4
  As a developer
5
- I want to mave a stable API
5
+ I want to have a stable API
6
6
 
7
7
  Scenario: the demo example reports as expected
8
8
  When I run reek spec/samples/demo
@@ -12,9 +12,9 @@ Feature: The Reek API maintains backwards compatibility
12
12
  spec/samples/demo/demo.rb -- 6 warnings:
13
13
  Dirty has no descriptive comment (IrresponsibleModule)
14
14
  Dirty#awful has 4 parameters (LongParameterList)
15
- Dirty#awful has boolean parameter 'log' (ControlCouple)
16
- Dirty#awful has the parameter name 'x' (UncommunicativeName)
17
- Dirty#awful has the parameter name 'y' (UncommunicativeName)
18
- Dirty#awful has the variable name 'w' (UncommunicativeName)
15
+ Dirty#awful has boolean parameter 'log' (BooleanParameter)
16
+ Dirty#awful has the parameter name 'x' (UncommunicativeParameterName)
17
+ Dirty#awful has the parameter name 'y' (UncommunicativeParameterName)
18
+ Dirty#awful has the variable name 'w' (UncommunicativeVariableName)
19
19
 
20
20
  """
@@ -2,176 +2,168 @@
2
2
  Feature: Basic smell detection
3
3
  In order to write better software
4
4
  As a developer
5
- I want to detect the smels in my Ruby code
5
+ I want to detect the smells in my Ruby code
6
6
 
7
7
  @inline
8
8
  Scenario: Correct smells from inline.rb
9
9
  When I run reek spec/samples/inline.rb
10
10
  Then the exit status indicates smells
11
- And it reports:
12
- """
13
- spec/samples/inline.rb -- 41 warnings:
14
- File has no descriptive comment (IrresponsibleModule)
15
- Inline declares the class variable @@directory (ClassVariable)
16
- Inline declares the class variable @@rootdir (ClassVariable)
17
- Inline#self.rootdir calls env.nil? twice (Duplication)
18
- Inline#self.rootdir has approx 8 statements (LongMethod)
19
- Inline::C declares the class variable @@type_map (ClassVariable)
20
- Inline::C has at least 13 instance variables (LargeClass)
21
- Inline::C takes parameters [options, src] to 5 methods (DataClump)
22
- Inline::C tests $DEBUG at least 7 times (SimulatedPolymorphism)
23
- Inline::C tests $TESTING at least 4 times (SimulatedPolymorphism)
24
- Inline::C tests @@type_map.has_key?(type) at least 3 times (SimulatedPolymorphism)
25
- Inline::C#build calls ($? == 0) twice (Duplication)
26
- Inline::C#build calls Inline.directory 5 times (Duplication)
27
- Inline::C#build calls io.puts 6 times (Duplication)
28
- Inline::C#build calls io.puts("#endif") twice (Duplication)
29
- Inline::C#build calls io.puts("#ifdef __cplusplus") twice (Duplication)
30
- Inline::C#build calls module_name twice (Duplication)
31
- Inline::C#build calls warn("Output:\n#{result}") twice (Duplication)
32
- Inline::C#build contains iterators nested 2 deep (NestedIterators)
33
- Inline::C#build has approx 60 statements (LongMethod)
34
- Inline::C#build has the variable name 'n' (UncommunicativeName)
35
- Inline::C#build has the variable name 't' (UncommunicativeName)
36
- Inline::C#c has the name 'c' (UncommunicativeName)
37
- Inline::C#crap_for_windoze calls Config::CONFIG["libdir"] twice (Duplication)
38
- Inline::C#generate calls result.sub!(/\A\n/, "") twice (Duplication)
39
- Inline::C#generate calls signature["args"] twice (Duplication)
40
- Inline::C#generate calls signature["args"].map twice (Duplication)
41
- Inline::C#generate has approx 32 statements (LongMethod)
42
- Inline::C#initialize calls stack.empty? twice (Duplication)
43
- Inline::C#load calls so_name twice (Duplication)
44
- Inline::C#module_name has the variable name 'm' (UncommunicativeName)
45
- Inline::C#module_name has the variable name 'x' (UncommunicativeName)
46
- Inline::C#parse_signature has approx 15 statements (LongMethod)
47
- Inline::C#parse_signature has boolean parameter 'raw' (ControlCouple)
48
- Inline::C#parse_signature has the variable name 'x' (UncommunicativeName)
49
- Inline::C#parse_signature is controlled by argument raw (ControlCouple)
50
- Inline::C#strip_comments doesn't depend on instance state (LowCohesion)
51
- Inline::C#strip_comments refers to src more than self (LowCohesion)
52
- Module#inline calls Inline.const_get(lang) twice (Duplication)
53
- Module#inline has approx 11 statements (LongMethod)
54
- Module#inline is controlled by argument options (ControlCouple)
55
-
56
- """
11
+ And it reports something like: spec/samples/inline.rb -- 41 warnings:
12
+ And it reports something like: File has no descriptive comment (IrresponsibleModule)
13
+ And it reports something like: Inline declares the class variable @@directory (ClassVariable)
14
+ And it reports something like: Inline declares the class variable @@rootdir (ClassVariable)
15
+ And it reports something like: Inline#self.rootdir calls env.nil? twice (DuplicateMethodCall)
16
+ And it reports something like: Inline#self.rootdir has approx 8 statements (TooManyStatements)
17
+ And it reports something like: Inline::C declares the class variable @@type_map (ClassVariable)
18
+ And it reports something like: Inline::C has at least 13 instance variables (TooManyInstanceVariables)
19
+ And it reports something like: Inline::C takes parameters [options, src] to 5 methods (DataClump)
20
+ And it reports something like: Inline::C tests $DEBUG at least 7 times (RepeatedConditional)
21
+ And it reports something like: Inline::C tests $TESTING at least 4 times (RepeatedConditional)
22
+ And it reports something like: Inline::C tests @@type_map.has_key?(type) at least 3 times (RepeatedConditional)
23
+ And it reports something like: Inline::C#build calls ($? == 0) twice (DuplicateMethodCall)
24
+ And it reports something like: Inline::C#build calls Inline.directory 5 times (DuplicateMethodCall)
25
+ And it reports something like: Inline::C#build calls io.puts 6 times (DuplicateMethodCall)
26
+ And it reports something like: Inline::C#build calls io.puts("#endif") twice (DuplicateMethodCall)
27
+ And it reports something like: Inline::C#build calls io.puts("#ifdef __cplusplus") twice (DuplicateMethodCall)
28
+ And it reports something like: Inline::C#build calls module_name twice (DuplicateMethodCall)
29
+ And it reports something like (pending): Inline::C#build calls warn("Output:\n#{result}") twice (DuplicateMethodCall)
30
+ And it reports something like: Inline::C#build contains iterators nested 2 deep (NestedIterators)
31
+ And it reports something like: Inline::C#build has approx 60 statements (TooManyStatements)
32
+ And it reports something like: Inline::C#build has the variable name 'n' (UncommunicativeVariableName)
33
+ And it reports something like: Inline::C#build has the variable name 't' (UncommunicativeVariableName)
34
+ And it reports something like: Inline::C#c has the name 'c' (UncommunicativeMethodName)
35
+ And it reports something like: Inline::C#crap_for_windoze calls Config::CONFIG["libdir"] twice (DuplicateMethodCall)
36
+ And it reports something like: Inline::C#generate calls result.sub!(/\A\n/, "") twice (DuplicateMethodCall)
37
+ And it reports something like: Inline::C#generate calls signature["args"] twice (DuplicateMethodCall)
38
+ And it reports something like: Inline::C#generate calls signature["args"].map twice (DuplicateMethodCall)
39
+ And it reports something like: Inline::C#generate has approx 32 statements (TooManyStatements)
40
+ And it reports something like: Inline::C#initialize calls stack.empty? twice (DuplicateMethodCall)
41
+ And it reports something like: Inline::C#load calls so_name twice (DuplicateMethodCall)
42
+ And it reports something like: Inline::C#module_name has the variable name 'm' (UncommunicativeVariableName)
43
+ And it reports something like: Inline::C#module_name has the variable name 'x' (UncommunicativeVariableName)
44
+ And it reports something like: Inline::C#parse_signature has approx 15 statements (TooManyStatements)
45
+ And it reports something like: Inline::C#parse_signature has boolean parameter 'raw' (BooleanParameter)
46
+ And it reports something like: Inline::C#parse_signature has the variable name 'x' (UncommunicativeVariableName)
47
+ And it reports something like: Inline::C#parse_signature is controlled by argument raw (ControlParameter)
48
+ And it reports something like: Inline::C#strip_comments doesn't depend on instance state (UtilityFunction)
49
+ And it reports something like: Inline::C#strip_comments refers to src more than self (FeatureEnvy)
50
+ And it reports something like: Module#inline calls Inline.const_get(lang) twice (DuplicateMethodCall)
51
+ And it reports something like: Module#inline has approx 11 statements (TooManyStatements)
52
+ And it reports something like: Module#inline is controlled by argument options (ControlParameter)
57
53
 
58
54
  Scenario: Correct smells from optparse.rb
59
55
  When I run reek spec/samples/optparse.rb
60
56
  Then the exit status indicates smells
61
- And it reports:
62
- """
63
- spec/samples/optparse.rb -- 109 warnings:
64
- OptionParser has at least 42 methods (LargeClass)
65
- OptionParser has the variable name 'f' (UncommunicativeName)
66
- OptionParser has the variable name 'k' (UncommunicativeName)
67
- OptionParser has the variable name 'o' (UncommunicativeName)
68
- OptionParser has the variable name 's' (UncommunicativeName)
69
- OptionParser has the variable name 'v' (UncommunicativeName)
70
- OptionParser tests ((argv.size == 1) and Array.===(argv[0])) at least 3 times (SimulatedPolymorphism)
71
- OptionParser tests a at least 7 times (SimulatedPolymorphism)
72
- OptionParser tests default_pattern at least 7 times (SimulatedPolymorphism)
73
- OptionParser tests not_style at least 3 times (SimulatedPolymorphism)
74
- OptionParser tests s at least 7 times (SimulatedPolymorphism)
75
- OptionParser#complete contains iterators nested 2 deep (NestedIterators)
76
- OptionParser#complete has 4 parameters (LongParameterList)
77
- OptionParser#complete has boolean parameter 'icase' (ControlCouple)
78
- OptionParser#getopts calls result[opt] = false twice (Duplication)
79
- OptionParser#getopts has approx 17 statements (LongMethod)
80
- OptionParser#load has the variable name 's' (UncommunicativeName)
81
- OptionParser#make_switch calls (long << o = q.downcase) twice (Duplication)
82
- OptionParser#make_switch calls (sdesc << "-#{q}") twice (Duplication)
83
- OptionParser#make_switch calls default_style.guess(arg = a) 4 times (Duplication)
84
- OptionParser#make_switch calls notwice(NilClass, klass, "type") twice (Duplication)
85
- OptionParser#make_switch calls notwice(a ? (Object) : (TrueClass), klass, "type") twice (Duplication)
86
- OptionParser#make_switch calls pattern.method(:convert) twice (Duplication)
87
- OptionParser#make_switch calls pattern.method(:convert).to_proc twice (Duplication)
88
- OptionParser#make_switch calls pattern.respond_to?(:convert) twice (Duplication)
89
- OptionParser#make_switch calls q.downcase 3 times (Duplication)
90
- OptionParser#make_switch calls search(:atype, FalseClass) twice (Duplication)
91
- OptionParser#make_switch calls search(:atype, o) 6 times (Duplication)
92
- OptionParser#make_switch contains iterators nested 2 deep (NestedIterators)
93
- OptionParser#make_switch contains iterators nested 3 deep (NestedIterators)
94
- OptionParser#make_switch has approx 68 statements (LongMethod)
95
- OptionParser#make_switch has the variable name 'a' (UncommunicativeName)
96
- OptionParser#make_switch has the variable name 'c' (UncommunicativeName)
97
- OptionParser#make_switch has the variable name 'n' (UncommunicativeName)
98
- OptionParser#make_switch has the variable name 'o' (UncommunicativeName)
99
- OptionParser#make_switch has the variable name 'q' (UncommunicativeName)
100
- OptionParser#make_switch has the variable name 's' (UncommunicativeName)
101
- OptionParser#make_switch has the variable name 'v' (UncommunicativeName)
102
- OptionParser#order calls argv[0] twice (Duplication)
103
- OptionParser#order refers to argv more than self (LowCohesion)
104
- OptionParser#parse calls argv[0] twice (Duplication)
105
- OptionParser#parse refers to argv more than self (LowCohesion)
106
- OptionParser#parse_in_order calls $!.set_option(arg, true) twice (Duplication)
107
- OptionParser#parse_in_order calls cb.call(val) twice (Duplication)
108
- OptionParser#parse_in_order calls raise($!.set_option(arg, true)) twice (Duplication)
109
- OptionParser#parse_in_order calls raise(*exc) twice (Duplication)
110
- OptionParser#parse_in_order calls setter.call(sw.switch_name, val) twice (Duplication)
111
- OptionParser#parse_in_order calls sw.block twice (Duplication)
112
- OptionParser#parse_in_order calls sw.switch_name twice (Duplication)
113
- OptionParser#parse_in_order contains iterators nested 2 deep (NestedIterators)
114
- OptionParser#parse_in_order contains iterators nested 3 deep (NestedIterators)
115
- OptionParser#parse_in_order has approx 28 statements (LongMethod)
116
- OptionParser#parse_in_order is controlled by argument setter (ControlCouple)
117
- OptionParser#permute calls argv[0] twice (Duplication)
118
- OptionParser#permute refers to argv more than self (LowCohesion)
119
- OptionParser#search has the variable name 'k' (UncommunicativeName)
120
- OptionParser#summarize has 4 parameters (LongParameterList)
121
- OptionParser#summarize has the variable name 'l' (UncommunicativeName)
122
- OptionParser#ver has the variable name 'v' (UncommunicativeName)
123
- OptionParser::CompletingHash#match contains iterators nested 2 deep (NestedIterators)
124
- OptionParser::Completion#complete calls candidates.size twice (Duplication)
125
- OptionParser::Completion#complete calls k.id2name twice (Duplication)
126
- OptionParser::Completion#complete has approx 22 statements (LongMethod)
127
- OptionParser::Completion#complete has boolean parameter 'icase' (ControlCouple)
128
- OptionParser::Completion#complete has the variable name 'k' (UncommunicativeName)
129
- OptionParser::Completion#complete has the variable name 'v' (UncommunicativeName)
130
- OptionParser::Completion#complete refers to candidates more than self (LowCohesion)
131
- OptionParser::List#accept has the parameter name 't' (UncommunicativeName)
132
- OptionParser::List#accept is controlled by argument pat (ControlCouple)
133
- OptionParser::List#accept refers to pat more than self (LowCohesion)
134
- OptionParser::List#add_banner refers to opt more than self (LowCohesion)
135
- OptionParser::List#complete has 4 parameters (LongParameterList)
136
- OptionParser::List#complete has boolean parameter 'icase' (ControlCouple)
137
- OptionParser::List#reject has the parameter name 't' (UncommunicativeName)
138
- OptionParser::List#summarize refers to opt more than self (LowCohesion)
139
- OptionParser::List#update has 5 parameters (LongParameterList)
140
- OptionParser::List#update has approx 6 statements (LongMethod)
141
- OptionParser::List#update has the variable name 'o' (UncommunicativeName)
142
- OptionParser::List#update is controlled by argument lopts (ControlCouple)
143
- OptionParser::List#update is controlled by argument sopts (ControlCouple)
144
- OptionParser::ParseError#set_option is controlled by argument eq (ControlCouple)
145
- OptionParser::Switch#add_banner has the variable name 's' (UncommunicativeName)
146
- OptionParser::Switch#conv_arg calls conv twice (Duplication)
147
- OptionParser::Switch#initialize has 7 parameters (LongParameterList)
148
- OptionParser::Switch#parse_arg calls pattern twice (Duplication)
149
- OptionParser::Switch#parse_arg calls s.length twice (Duplication)
150
- OptionParser::Switch#parse_arg has approx 11 statements (LongMethod)
151
- OptionParser::Switch#parse_arg has the variable name 'm' (UncommunicativeName)
152
- OptionParser::Switch#parse_arg has the variable name 's' (UncommunicativeName)
153
- OptionParser::Switch#self.guess has the variable name 't' (UncommunicativeName)
154
- OptionParser::Switch#self.incompatible_argument_styles has the parameter name 't' (UncommunicativeName)
155
- OptionParser::Switch#summarize calls (indent + l) twice (Duplication)
156
- OptionParser::Switch#summarize calls arg 4 times (Duplication)
157
- OptionParser::Switch#summarize calls left.collect twice (Duplication)
158
- OptionParser::Switch#summarize calls left.collect { |s| s.length }.max twice (Duplication)
159
- OptionParser::Switch#summarize calls left.collect { |s| s.length }.max.to_i twice (Duplication)
160
- OptionParser::Switch#summarize calls left.shift twice (Duplication)
161
- OptionParser::Switch#summarize calls left[-1] 3 times (Duplication)
162
- OptionParser::Switch#summarize calls s.length 3 times (Duplication)
163
- OptionParser::Switch#summarize contains iterators nested 2 deep (NestedIterators)
164
- OptionParser::Switch#summarize has 5 parameters (LongParameterList)
165
- OptionParser::Switch#summarize has approx 25 statements (LongMethod)
166
- OptionParser::Switch#summarize has the variable name 'l' (UncommunicativeName)
167
- OptionParser::Switch#summarize has the variable name 'r' (UncommunicativeName)
168
- OptionParser::Switch#summarize has the variable name 's' (UncommunicativeName)
169
- OptionParser::Switch::NoArgument#parse is controlled by argument arg (ControlCouple)
170
- OptionParser::Switch::OptionalArgument#parse is controlled by argument arg (ControlCouple)
171
- OptionParser::Switch::PlacedArgument#parse has approx 6 statements (LongMethod)
172
- OptionParser::Switch::RequiredArgument#parse is controlled by argument arg (ControlCouple)
173
-
174
- """
57
+ And it reports something like: spec/samples/optparse.rb -- 109 warnings:
58
+ And it reports something like: OptionParser has at least 42 methods (TooManyMethods)
59
+ And it reports something like: OptionParser has the variable name 'f' (UncommunicativeVariableName)
60
+ And it reports something like: OptionParser has the variable name 'k' (UncommunicativeVariableName)
61
+ And it reports something like: OptionParser has the variable name 'o' (UncommunicativeVariableName)
62
+ And it reports something like: OptionParser has the variable name 's' (UncommunicativeVariableName)
63
+ And it reports something like: OptionParser has the variable name 'v' (UncommunicativeVariableName)
64
+ And it reports something like: OptionParser tests ((argv.size == 1) and Array.===(argv[0])) at least 3 times (RepeatedConditional)
65
+ And it reports something like: OptionParser tests a at least 7 times (RepeatedConditional)
66
+ And it reports something like: OptionParser tests default_pattern at least 7 times (RepeatedConditional)
67
+ And it reports something like: OptionParser tests not_style at least 3 times (RepeatedConditional)
68
+ And it reports something like: OptionParser tests s at least 7 times (RepeatedConditional)
69
+ And it reports something like: OptionParser#complete contains iterators nested 2 deep (NestedIterators)
70
+ And it reports something like: OptionParser#complete has 4 parameters (LongParameterList)
71
+ And it reports something like: OptionParser#complete has boolean parameter 'icase' (BooleanParameter)
72
+ And it reports something like: OptionParser#getopts calls result[opt] = false twice (DuplicateMethodCall)
73
+ And it reports something like: OptionParser#getopts has approx 17 statements (TooManyStatements)
74
+ And it reports something like: OptionParser#load has the variable name 's' (UncommunicativeVariableName)
75
+ And it reports something like: OptionParser#make_switch calls (long << o = q.downcase) twice (DuplicateMethodCall)
76
+ And it reports something like (pending): OptionParser#make_switch calls (sdesc << "-#{q}") twice (DuplicateMethodCall)
77
+ And it reports something like: OptionParser#make_switch calls default_style.guess(arg = a) 4 times (DuplicateMethodCall)
78
+ And it reports something like: OptionParser#make_switch calls notwice(NilClass, klass, "type") twice (DuplicateMethodCall)
79
+ And it reports something like: OptionParser#make_switch calls notwice(a ? (Object) : (TrueClass), klass, "type") twice (DuplicateMethodCall)
80
+ And it reports something like: OptionParser#make_switch calls pattern.method(:convert) twice (DuplicateMethodCall)
81
+ And it reports something like: OptionParser#make_switch calls pattern.method(:convert).to_proc twice (DuplicateMethodCall)
82
+ And it reports something like: OptionParser#make_switch calls pattern.respond_to?(:convert) twice (DuplicateMethodCall)
83
+ And it reports something like: OptionParser#make_switch calls q.downcase 3 times (DuplicateMethodCall)
84
+ And it reports something like: OptionParser#make_switch calls search(:atype, FalseClass) twice (DuplicateMethodCall)
85
+ And it reports something like: OptionParser#make_switch calls search(:atype, o) 6 times (DuplicateMethodCall)
86
+ And it reports something like: OptionParser#make_switch contains iterators nested 2 deep (NestedIterators)
87
+ And it reports something like: OptionParser#make_switch contains iterators nested 3 deep (NestedIterators)
88
+ And it reports something like: OptionParser#make_switch has approx 68 statements (TooManyStatements)
89
+ And it reports something like: OptionParser#make_switch has the variable name 'a' (UncommunicativeVariableName)
90
+ And it reports something like: OptionParser#make_switch has the variable name 'c' (UncommunicativeVariableName)
91
+ And it reports something like: OptionParser#make_switch has the variable name 'n' (UncommunicativeVariableName)
92
+ And it reports something like: OptionParser#make_switch has the variable name 'o' (UncommunicativeVariableName)
93
+ And it reports something like: OptionParser#make_switch has the variable name 'q' (UncommunicativeVariableName)
94
+ And it reports something like: OptionParser#make_switch has the variable name 's' (UncommunicativeVariableName)
95
+ And it reports something like: OptionParser#make_switch has the variable name 'v' (UncommunicativeVariableName)
96
+ And it reports something like: OptionParser#order calls argv[0] twice (DuplicateMethodCall)
97
+ And it reports something like: OptionParser#order refers to argv more than self (FeatureEnvy)
98
+ And it reports something like: OptionParser#parse calls argv[0] twice (DuplicateMethodCall)
99
+ And it reports something like: OptionParser#parse refers to argv more than self (FeatureEnvy)
100
+ And it reports something like: OptionParser#parse_in_order calls $!.set_option(arg, true) twice (DuplicateMethodCall)
101
+ And it reports something like: OptionParser#parse_in_order calls cb.call(val) twice (DuplicateMethodCall)
102
+ And it reports something like: OptionParser#parse_in_order calls raise($!.set_option(arg, true)) twice (DuplicateMethodCall)
103
+ And it reports something like: OptionParser#parse_in_order calls raise(*exc) twice (DuplicateMethodCall)
104
+ And it reports something like: OptionParser#parse_in_order calls setter.call(sw.switch_name, val) twice (DuplicateMethodCall)
105
+ And it reports something like: OptionParser#parse_in_order calls sw.block twice (DuplicateMethodCall)
106
+ And it reports something like: OptionParser#parse_in_order calls sw.switch_name twice (DuplicateMethodCall)
107
+ And it reports something like: OptionParser#parse_in_order contains iterators nested 2 deep (NestedIterators)
108
+ And it reports something like: OptionParser#parse_in_order contains iterators nested 3 deep (NestedIterators)
109
+ And it reports something like: OptionParser#parse_in_order has approx 28 statements (TooManyStatements)
110
+ And it reports something like: OptionParser#parse_in_order is controlled by argument setter (ControlParameter)
111
+ And it reports something like: OptionParser#permute calls argv[0] twice (DuplicateMethodCall)
112
+ And it reports something like: OptionParser#permute refers to argv more than self (FeatureEnvy)
113
+ And it reports something like: OptionParser#search has the variable name 'k' (UncommunicativeVariableName)
114
+ And it reports something like: OptionParser#summarize has 4 parameters (LongParameterList)
115
+ And it reports something like: OptionParser#summarize has the variable name 'l' (UncommunicativeVariableName)
116
+ And it reports something like: OptionParser#ver has the variable name 'v' (UncommunicativeVariableName)
117
+ And it reports something like: OptionParser::CompletingHash#match contains iterators nested 2 deep (NestedIterators)
118
+ And it reports something like: OptionParser::Completion#complete calls candidates.size twice (DuplicateMethodCall)
119
+ And it reports something like: OptionParser::Completion#complete calls k.id2name twice (DuplicateMethodCall)
120
+ And it reports something like: OptionParser::Completion#complete has approx 22 statements (TooManyStatements)
121
+ And it reports something like: OptionParser::Completion#complete has boolean parameter 'icase' (BooleanParameter)
122
+ And it reports something like: OptionParser::Completion#complete has the variable name 'k' (UncommunicativeVariableName)
123
+ And it reports something like: OptionParser::Completion#complete has the variable name 'v' (UncommunicativeVariableName)
124
+ And it reports something like: OptionParser::Completion#complete refers to candidates more than self (FeatureEnvy)
125
+ And it reports something like: OptionParser::List#accept has the parameter name 't' (UncommunicativeParameterName)
126
+ And it reports something like: OptionParser::List#accept is controlled by argument pat (ControlParameter)
127
+ And it reports something like: OptionParser::List#accept refers to pat more than self (FeatureEnvy)
128
+ And it reports something like: OptionParser::List#add_banner refers to opt more than self (FeatureEnvy)
129
+ And it reports something like: OptionParser::List#complete has 4 parameters (LongParameterList)
130
+ And it reports something like: OptionParser::List#complete has boolean parameter 'icase' (BooleanParameter)
131
+ And it reports something like: OptionParser::List#reject has the parameter name 't' (UncommunicativeParameterName)
132
+ And it reports something like: OptionParser::List#summarize refers to opt more than self (FeatureEnvy)
133
+ And it reports something like: OptionParser::List#update has 5 parameters (LongParameterList)
134
+ And it reports something like: OptionParser::List#update has approx 6 statements (TooManyStatements)
135
+ And it reports something like: OptionParser::List#update has the variable name 'o' (UncommunicativeVariableName)
136
+ And it reports something like: OptionParser::List#update is controlled by argument lopts (ControlParameter)
137
+ And it reports something like: OptionParser::List#update is controlled by argument sopts (ControlParameter)
138
+ And it reports something like: OptionParser::ParseError#set_option is controlled by argument eq (ControlParameter)
139
+ And it reports something like: OptionParser::Switch#add_banner has the variable name 's' (UncommunicativeVariableName)
140
+ And it reports something like: OptionParser::Switch#conv_arg calls conv twice (DuplicateMethodCall)
141
+ And it reports something like: OptionParser::Switch#initialize has 7 parameters (LongParameterList)
142
+ And it reports something like: OptionParser::Switch#parse_arg calls pattern twice (DuplicateMethodCall)
143
+ And it reports something like: OptionParser::Switch#parse_arg calls s.length twice (DuplicateMethodCall)
144
+ And it reports something like: OptionParser::Switch#parse_arg has approx 11 statements (TooManyStatements)
145
+ And it reports something like: OptionParser::Switch#parse_arg has the variable name 'm' (UncommunicativeVariableName)
146
+ And it reports something like: OptionParser::Switch#parse_arg has the variable name 's' (UncommunicativeVariableName)
147
+ And it reports something like: OptionParser::Switch#self.guess has the variable name 't' (UncommunicativeVariableName)
148
+ And it reports something like: OptionParser::Switch#self.incompatible_argument_styles has the parameter name 't' (UncommunicativeParameterName)
149
+ And it reports something like: OptionParser::Switch#summarize calls (indent + l) twice (DuplicateMethodCall)
150
+ And it reports something like: OptionParser::Switch#summarize calls arg 4 times (DuplicateMethodCall)
151
+ And it reports something like: OptionParser::Switch#summarize calls left.collect twice (DuplicateMethodCall)
152
+ And it reports something like: OptionParser::Switch#summarize calls left.collect { |s| s.length }.max twice (DuplicateMethodCall)
153
+ And it reports something like: OptionParser::Switch#summarize calls left.collect { |s| s.length }.max.to_i twice (DuplicateMethodCall)
154
+ And it reports something like: OptionParser::Switch#summarize calls left.shift twice (DuplicateMethodCall)
155
+ And it reports something like: OptionParser::Switch#summarize calls left[-1] 3 times (DuplicateMethodCall)
156
+ And it reports something like: OptionParser::Switch#summarize calls s.length 3 times (DuplicateMethodCall)
157
+ And it reports something like: OptionParser::Switch#summarize contains iterators nested 2 deep (NestedIterators)
158
+ And it reports something like: OptionParser::Switch#summarize has 5 parameters (LongParameterList)
159
+ And it reports something like: OptionParser::Switch#summarize has approx 25 statements (TooManyStatements)
160
+ And it reports something like: OptionParser::Switch#summarize has the variable name 'l' (UncommunicativeVariableName)
161
+ And it reports something like: OptionParser::Switch#summarize has the variable name 'r' (UncommunicativeVariableName)
162
+ And it reports something like: OptionParser::Switch#summarize has the variable name 's' (UncommunicativeVariableName)
163
+ And it reports something like: OptionParser::Switch::NoArgument#parse is controlled by argument arg (ControlParameter)
164
+ And it reports something like: OptionParser::Switch::OptionalArgument#parse is controlled by argument arg (ControlParameter)
165
+ And it reports something like: OptionParser::Switch::PlacedArgument#parse has approx 6 statements (TooManyStatements)
166
+ And it reports something like: OptionParser::Switch::RequiredArgument#parse is controlled by argument arg (ControlParameter)
175
167
 
176
168
  Scenario: Correct smells from redcloth.rb
177
169
  When I run reek spec/samples/redcloth.rb
@@ -179,102 +171,102 @@ Feature: Basic smell detection
179
171
  And it reports:
180
172
  """
181
173
  spec/samples/redcloth.rb -- 97 warnings:
182
- RedCloth has at least 44 methods (LargeClass)
183
- RedCloth has the variable name 'a' (UncommunicativeName)
184
- RedCloth has the variable name 'b' (UncommunicativeName)
174
+ RedCloth has at least 44 methods (TooManyMethods)
175
+ RedCloth has the variable name 'a' (UncommunicativeVariableName)
176
+ RedCloth has the variable name 'b' (UncommunicativeVariableName)
185
177
  RedCloth takes parameters [atts, cite, content, tag] to 3 methods (DataClump)
186
- RedCloth tests atts at least 6 times (SimulatedPolymorphism)
187
- RedCloth tests codepre.zero? at least 3 times (SimulatedPolymorphism)
188
- RedCloth tests href at least 3 times (SimulatedPolymorphism)
189
- RedCloth tests title at least 4 times (SimulatedPolymorphism)
190
- RedCloth#block_markdown_atx refers to text more than self (LowCohesion)
191
- RedCloth#block_markdown_bq has approx 6 statements (LongMethod)
192
- RedCloth#block_markdown_rule refers to text more than self (LowCohesion)
193
- RedCloth#block_markdown_setext refers to text more than self (LowCohesion)
194
- RedCloth#block_textile_lists calls (line_id - 1) twice (Duplication)
195
- RedCloth#block_textile_lists calls depth.last 5 times (Duplication)
196
- RedCloth#block_textile_lists calls depth.last.length twice (Duplication)
197
- RedCloth#block_textile_lists calls depth[i] twice (Duplication)
198
- RedCloth#block_textile_lists calls lines[(line_id - 1)] twice (Duplication)
199
- RedCloth#block_textile_lists calls tl.length 3 times (Duplication)
178
+ RedCloth tests atts at least 6 times (RepeatedConditional)
179
+ RedCloth tests codepre.zero? at least 3 times (RepeatedConditional)
180
+ RedCloth tests href at least 3 times (RepeatedConditional)
181
+ RedCloth tests title at least 4 times (RepeatedConditional)
182
+ RedCloth#block_markdown_atx refers to text more than self (FeatureEnvy)
183
+ RedCloth#block_markdown_bq has approx 6 statements (TooManyStatements)
184
+ RedCloth#block_markdown_rule refers to text more than self (FeatureEnvy)
185
+ RedCloth#block_markdown_setext refers to text more than self (FeatureEnvy)
186
+ RedCloth#block_textile_lists calls (line_id - 1) twice (DuplicateMethodCall)
187
+ RedCloth#block_textile_lists calls depth.last 5 times (DuplicateMethodCall)
188
+ RedCloth#block_textile_lists calls depth.last.length twice (DuplicateMethodCall)
189
+ RedCloth#block_textile_lists calls depth[i] twice (DuplicateMethodCall)
190
+ RedCloth#block_textile_lists calls lines[(line_id - 1)] twice (DuplicateMethodCall)
191
+ RedCloth#block_textile_lists calls tl.length 3 times (DuplicateMethodCall)
200
192
  RedCloth#block_textile_lists contains iterators nested 3 deep (NestedIterators)
201
- RedCloth#block_textile_lists has approx 20 statements (LongMethod)
202
- RedCloth#block_textile_lists has the variable name 'i' (UncommunicativeName)
203
- RedCloth#block_textile_lists has the variable name 'v' (UncommunicativeName)
204
- RedCloth#block_textile_lists refers to depth more than self (LowCohesion)
193
+ RedCloth#block_textile_lists has approx 20 statements (TooManyStatements)
194
+ RedCloth#block_textile_lists has the variable name 'i' (UncommunicativeVariableName)
195
+ RedCloth#block_textile_lists has the variable name 'v' (UncommunicativeVariableName)
196
+ RedCloth#block_textile_lists refers to depth more than self (FeatureEnvy)
205
197
  RedCloth#block_textile_table contains iterators nested 2 deep (NestedIterators)
206
198
  RedCloth#block_textile_table contains iterators nested 3 deep (NestedIterators)
207
- RedCloth#block_textile_table has approx 18 statements (LongMethod)
208
- RedCloth#block_textile_table has the variable name 'x' (UncommunicativeName)
199
+ RedCloth#block_textile_table has approx 18 statements (TooManyStatements)
200
+ RedCloth#block_textile_table has the variable name 'x' (UncommunicativeVariableName)
209
201
  RedCloth#blocks contains iterators nested 2 deep (NestedIterators)
210
- RedCloth#blocks has approx 18 statements (LongMethod)
211
- RedCloth#blocks has boolean parameter 'deep_code' (ControlCouple)
212
- RedCloth#blocks is controlled by argument deep_code (ControlCouple)
213
- RedCloth#check_refs is controlled by argument text (ControlCouple)
214
- RedCloth#clean_html calls tags[tag] twice (Duplication)
202
+ RedCloth#blocks has approx 18 statements (TooManyStatements)
203
+ RedCloth#blocks has boolean parameter 'deep_code' (BooleanParameter)
204
+ RedCloth#blocks is controlled by argument deep_code (ControlParameter)
205
+ RedCloth#check_refs is controlled by argument text (ControlParameter)
206
+ RedCloth#clean_html calls tags[tag] twice (DuplicateMethodCall)
215
207
  RedCloth#clean_html contains iterators nested 3 deep (NestedIterators)
216
- RedCloth#clean_html doesn't depend on instance state (LowCohesion)
217
- RedCloth#clean_html has approx 14 statements (LongMethod)
218
- RedCloth#clean_html has the variable name 'q' (UncommunicativeName)
219
- RedCloth#clean_html has the variable name 'q2' (UncommunicativeName)
220
- RedCloth#clean_html refers to raw more than self (LowCohesion)
221
- RedCloth#clean_html refers to tags more than self (LowCohesion)
222
- RedCloth#clean_white_space has approx 7 statements (LongMethod)
223
- RedCloth#clean_white_space refers to text more than self (LowCohesion)
224
- RedCloth#flush_left doesn't depend on instance state (LowCohesion)
225
- RedCloth#flush_left refers to indt more than self (LowCohesion)
226
- RedCloth#flush_left refers to text more than self (LowCohesion)
227
- RedCloth#footnote_ref refers to text more than self (LowCohesion)
228
- RedCloth#glyphs_textile has approx 10 statements (LongMethod)
229
- RedCloth#htmlesc doesn't depend on instance state (LowCohesion)
230
- RedCloth#htmlesc refers to str more than self (LowCohesion)
231
- RedCloth#incoming_entities refers to text more than self (LowCohesion)
232
- RedCloth#initialize has the variable name 'r' (UncommunicativeName)
208
+ RedCloth#clean_html doesn't depend on instance state (UtilityFunction)
209
+ RedCloth#clean_html has approx 14 statements (TooManyStatements)
210
+ RedCloth#clean_html has the variable name 'q' (UncommunicativeVariableName)
211
+ RedCloth#clean_html has the variable name 'q2' (UncommunicativeVariableName)
212
+ RedCloth#clean_html refers to raw more than self (FeatureEnvy)
213
+ RedCloth#clean_html refers to tags more than self (FeatureEnvy)
214
+ RedCloth#clean_white_space has approx 7 statements (TooManyStatements)
215
+ RedCloth#clean_white_space refers to text more than self (FeatureEnvy)
216
+ RedCloth#flush_left doesn't depend on instance state (UtilityFunction)
217
+ RedCloth#flush_left refers to indt more than self (FeatureEnvy)
218
+ RedCloth#flush_left refers to text more than self (FeatureEnvy)
219
+ RedCloth#footnote_ref refers to text more than self (FeatureEnvy)
220
+ RedCloth#glyphs_textile has approx 10 statements (TooManyStatements)
221
+ RedCloth#htmlesc doesn't depend on instance state (UtilityFunction)
222
+ RedCloth#htmlesc refers to str more than self (FeatureEnvy)
223
+ RedCloth#incoming_entities refers to text more than self (FeatureEnvy)
224
+ RedCloth#initialize has the variable name 'r' (UncommunicativeVariableName)
233
225
  RedCloth#inline contains iterators nested 2 deep (NestedIterators)
234
- RedCloth#inline_markdown_link has approx 6 statements (LongMethod)
235
- RedCloth#inline_markdown_link has the variable name 'm' (UncommunicativeName)
236
- RedCloth#inline_markdown_reflink has approx 8 statements (LongMethod)
237
- RedCloth#inline_markdown_reflink has the variable name 'm' (UncommunicativeName)
238
- RedCloth#inline_textile_code has the variable name 'm' (UncommunicativeName)
239
- RedCloth#inline_textile_image has approx 17 statements (LongMethod)
240
- RedCloth#inline_textile_image has the variable name 'href_a1' (UncommunicativeName)
241
- RedCloth#inline_textile_image has the variable name 'href_a2' (UncommunicativeName)
242
- RedCloth#inline_textile_image has the variable name 'm' (UncommunicativeName)
243
- RedCloth#inline_textile_link has approx 9 statements (LongMethod)
244
- RedCloth#inline_textile_link has the variable name 'm' (UncommunicativeName)
226
+ RedCloth#inline_markdown_link has approx 6 statements (TooManyStatements)
227
+ RedCloth#inline_markdown_link has the variable name 'm' (UncommunicativeVariableName)
228
+ RedCloth#inline_markdown_reflink has approx 8 statements (TooManyStatements)
229
+ RedCloth#inline_markdown_reflink has the variable name 'm' (UncommunicativeVariableName)
230
+ RedCloth#inline_textile_code has the variable name 'm' (UncommunicativeVariableName)
231
+ RedCloth#inline_textile_image has approx 17 statements (TooManyStatements)
232
+ RedCloth#inline_textile_image has the variable name 'href_a1' (UncommunicativeVariableName)
233
+ RedCloth#inline_textile_image has the variable name 'href_a2' (UncommunicativeVariableName)
234
+ RedCloth#inline_textile_image has the variable name 'm' (UncommunicativeVariableName)
235
+ RedCloth#inline_textile_link has approx 9 statements (TooManyStatements)
236
+ RedCloth#inline_textile_link has the variable name 'm' (UncommunicativeVariableName)
245
237
  RedCloth#inline_textile_span contains iterators nested 2 deep (NestedIterators)
246
- RedCloth#inline_textile_span has approx 8 statements (LongMethod)
247
- RedCloth#inline_textile_span has the variable name 'm' (UncommunicativeName)
248
- RedCloth#lT has the name 'lT' (UncommunicativeName)
249
- RedCloth#no_textile doesn't depend on instance state (LowCohesion)
250
- RedCloth#no_textile refers to text more than self (LowCohesion)
251
- RedCloth#pba calls $1.length twice (Duplication)
252
- RedCloth#pba has approx 21 statements (LongMethod)
253
- RedCloth#pba is controlled by argument text_in (ControlCouple)
254
- RedCloth#pba refers to style more than self (LowCohesion)
255
- RedCloth#pba refers to text more than self (LowCohesion)
256
- RedCloth#refs_markdown has the variable name 'm' (UncommunicativeName)
257
- RedCloth#refs_textile has the variable name 'm' (UncommunicativeName)
258
- RedCloth#retrieve has the variable name 'i' (UncommunicativeName)
259
- RedCloth#retrieve has the variable name 'r' (UncommunicativeName)
260
- RedCloth#rip_offtags calls ((codepre - used_offtags.length) > 0) twice (Duplication)
261
- RedCloth#rip_offtags calls (@pre_list.last << line) twice (Duplication)
262
- RedCloth#rip_offtags calls (codepre - used_offtags.length) twice (Duplication)
263
- RedCloth#rip_offtags calls @pre_list.last twice (Duplication)
264
- RedCloth#rip_offtags calls codepre.zero? twice (Duplication)
265
- RedCloth#rip_offtags calls htmlesc(line, :NoQuotes) twice (Duplication)
266
- RedCloth#rip_offtags calls used_offtags.length twice (Duplication)
267
- RedCloth#rip_offtags calls used_offtags["notextile"] 3 times (Duplication)
268
- RedCloth#rip_offtags has approx 18 statements (LongMethod)
238
+ RedCloth#inline_textile_span has approx 8 statements (TooManyStatements)
239
+ RedCloth#inline_textile_span has the variable name 'm' (UncommunicativeVariableName)
240
+ RedCloth#lT has the name 'lT' (UncommunicativeMethodName)
241
+ RedCloth#no_textile doesn't depend on instance state (UtilityFunction)
242
+ RedCloth#no_textile refers to text more than self (FeatureEnvy)
243
+ RedCloth#pba calls $1.length twice (DuplicateMethodCall)
244
+ RedCloth#pba has approx 21 statements (TooManyStatements)
245
+ RedCloth#pba is controlled by argument text_in (ControlParameter)
246
+ RedCloth#pba refers to style more than self (FeatureEnvy)
247
+ RedCloth#pba refers to text more than self (FeatureEnvy)
248
+ RedCloth#refs_markdown has the variable name 'm' (UncommunicativeVariableName)
249
+ RedCloth#refs_textile has the variable name 'm' (UncommunicativeVariableName)
250
+ RedCloth#retrieve has the variable name 'i' (UncommunicativeVariableName)
251
+ RedCloth#retrieve has the variable name 'r' (UncommunicativeVariableName)
252
+ RedCloth#rip_offtags calls ((codepre - used_offtags.length) > 0) twice (DuplicateMethodCall)
253
+ RedCloth#rip_offtags calls (@pre_list.last << line) twice (DuplicateMethodCall)
254
+ RedCloth#rip_offtags calls (codepre - used_offtags.length) twice (DuplicateMethodCall)
255
+ RedCloth#rip_offtags calls @pre_list.last twice (DuplicateMethodCall)
256
+ RedCloth#rip_offtags calls codepre.zero? twice (DuplicateMethodCall)
257
+ RedCloth#rip_offtags calls htmlesc(line, :NoQuotes) twice (DuplicateMethodCall)
258
+ RedCloth#rip_offtags calls used_offtags.length twice (DuplicateMethodCall)
259
+ RedCloth#rip_offtags calls used_offtags["notextile"] 3 times (DuplicateMethodCall)
260
+ RedCloth#rip_offtags has approx 18 statements (TooManyStatements)
269
261
  RedCloth#textile_bq has 4 parameters (LongParameterList)
270
- RedCloth#textile_bq is controlled by argument atts (ControlCouple)
271
- RedCloth#textile_bq is controlled by argument cite (ControlCouple)
262
+ RedCloth#textile_bq is controlled by argument atts (ControlParameter)
263
+ RedCloth#textile_bq is controlled by argument cite (ControlParameter)
272
264
  RedCloth#textile_fn_ has 5 parameters (LongParameterList)
273
- RedCloth#textile_fn_ is controlled by argument atts (ControlCouple)
265
+ RedCloth#textile_fn_ is controlled by argument atts (ControlParameter)
274
266
  RedCloth#textile_p has 4 parameters (LongParameterList)
275
- RedCloth#textile_p is controlled by argument atts (ControlCouple)
276
- RedCloth#textile_popup_help has the parameter name 'windowH' (UncommunicativeName)
277
- RedCloth#textile_popup_help has the parameter name 'windowW' (UncommunicativeName)
278
- RedCloth#to_html has approx 24 statements (LongMethod)
267
+ RedCloth#textile_p is controlled by argument atts (ControlParameter)
268
+ RedCloth#textile_popup_help has the parameter name 'windowH' (UncommunicativeParameterName)
269
+ RedCloth#textile_popup_help has the parameter name 'windowW' (UncommunicativeParameterName)
270
+ RedCloth#to_html has approx 24 statements (TooManyStatements)
279
271
 
280
272
  """