reek 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +5 -0
  3. data/README.md +27 -2
  4. data/features/command_line_interface/options.feature +5 -2
  5. data/features/command_line_interface/smells_count.feature +43 -45
  6. data/features/command_line_interface/stdin.feature +9 -15
  7. data/features/configuration_files/masking_smells.feature +9 -17
  8. data/features/rake_task/rake_task.feature +4 -4
  9. data/features/reports/reports.feature +80 -21
  10. data/features/samples.feature +8 -18
  11. data/features/step_definitions/reek_steps.rb +4 -0
  12. data/lib/reek/cli/application.rb +3 -6
  13. data/lib/reek/cli/command_line.rb +16 -6
  14. data/lib/reek/cli/reek_command.rb +4 -12
  15. data/lib/reek/cli/report.rb +61 -19
  16. data/lib/reek/config_file_exception.rb +5 -0
  17. data/lib/reek/smells/control_parameter.rb +45 -14
  18. data/lib/reek/smells/data_clump.rb +15 -39
  19. data/lib/reek/smells/duplicate_method_call.rb +76 -26
  20. data/lib/reek/source/config_file.rb +30 -19
  21. data/lib/reek/source/sexp_extensions.rb +139 -0
  22. data/lib/reek/source/sexp_node.rb +64 -0
  23. data/lib/reek/source/source_code.rb +1 -1
  24. data/lib/reek/source/tree_dresser.rb +30 -175
  25. data/lib/reek/spec/should_reek.rb +2 -5
  26. data/lib/reek/version.rb +1 -1
  27. data/reek.gemspec +1 -1
  28. data/spec/matchers/smell_of_matcher.rb +12 -15
  29. data/spec/reek/cli/report_spec.rb +10 -6
  30. data/spec/reek/core/code_parser_spec.rb +0 -6
  31. data/spec/reek/smells/control_parameter_spec.rb +195 -8
  32. data/spec/reek/smells/data_clump_spec.rb +28 -3
  33. data/spec/reek/smells/uncommunicative_method_name_spec.rb +7 -7
  34. data/spec/reek/source/sexp_extensions_spec.rb +290 -0
  35. data/spec/reek/source/sexp_node_spec.rb +28 -0
  36. data/spec/reek/source/source_code_spec.rb +59 -19
  37. data/spec/reek/source/tree_dresser_spec.rb +7 -314
  38. data/spec/reek/spec/should_reek_spec.rb +51 -64
  39. data/spec/samples/all_but_one_masked/dirty.rb +2 -2
  40. data/spec/samples/corrupt_config_file/dirty.rb +1 -0
  41. data/spec/samples/masked/dirty.rb +1 -1
  42. data/spec/samples/masked_by_dotfile/dirty.rb +2 -2
  43. data/spec/samples/no_config_file/dirty.rb +8 -0
  44. data/spec/samples/not_quite_masked/dirty.rb +0 -3
  45. data/spec/samples/three_smelly_files/dirty_one.rb +3 -0
  46. data/spec/samples/three_smelly_files/dirty_three.rb +5 -0
  47. data/spec/samples/three_smelly_files/dirty_two.rb +4 -0
  48. data/spec/spec_helper.rb +5 -0
  49. metadata +145 -137
  50. data/spec/reek/cli/reek_command_spec.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a55c84d8e8f1583544ec71d2eee88e6009bec7de
4
- data.tar.gz: 2293dce903da468f25b4bfb491fe1b60f5e13721
3
+ metadata.gz: ad832e1c2e46ca1fd1789a92f7b8b30854ff2215
4
+ data.tar.gz: 800911908bdc3111d76ff930e161a7d6f87fecf1
5
5
  SHA512:
6
- metadata.gz: d0083106eb1f3aac9ec626273072670c551c09f42d9624e2497120e9099243c5e8154a90d575b7a9dd0b7505de0787dd4c21218d03702e23dc8dcc904b9553d8
7
- data.tar.gz: dc91d3a860e07b2b1edb7c153df02c5e263c145209cf6c577f31cf091eb28da42f489a59a8193de593a98421926f44cf40fb3592bcec5d41afe06f6c73cdd7e5
6
+ metadata.gz: c4588f0c10b1bb8bb3e8ac9afab01f1209588919b8939a3dbec5276eb5b8383c9f55f52e68e5f111a21c77d72cc57fd9acc4755797383a6c72bc4ed86e04c42a
7
+ data.tar.gz: 22d3b703a28c5b561ac4f53d2e846333d2cda22b27e8e4931fe7ea64033d4436486e40b7f5d02838f06a4e76d88d7a7d44b98492b040794c57c23ec499baf935
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.3.5
2
+
3
+ * (troessner) Allow sorting by issue count
4
+ * (mvz) Improve cli options
5
+
1
6
  == 1.3.4
2
7
 
3
8
  * (apiology) Add --single-line option for reporting
data/README.md CHANGED
@@ -27,9 +27,32 @@ or run
27
27
  $ reek --help
28
28
  ```
29
29
 
30
- ## Example
30
+ ## Usage
31
31
 
32
- Imagine a source file <tt>demo.rb</tt> containing:
32
+ For scanning the current directory you're in do a
33
+
34
+ ```bash
35
+ $ reek .
36
+ ```
37
+
38
+ (Mind the "." at the end to indicate the current directory)
39
+
40
+
41
+ Likewise you can scan specific directories like this
42
+
43
+ ```bash
44
+ $ reek lib/your/files
45
+ ```
46
+
47
+ Note that if you just call
48
+
49
+ ```bash
50
+ $ reek
51
+ ```
52
+
53
+ without any arguments reek will wait for input from STDIN.
54
+
55
+ Given a source file <tt>demo.rb</tt> containing:
33
56
 
34
57
  ```ruby
35
58
  class Dirty
@@ -106,6 +129,8 @@ spec spec/your/file -u # Runs all tests stopping at the breakpoints you have
106
129
 
107
130
  There's a vim plugin for `reek`: [https://github.com/rainerborene/vim-reek](https://github.com/rainerborene/vim-reek)
108
131
 
132
+ TextMate Bundle for `reek`: [https://github.com/peeyush1234/reek.tmbundle](https://github.com/peeyush1234/reek.tmbundle)
133
+
109
134
  ### Dependencies
110
135
 
111
136
  Reek makes use of the following other gems:
@@ -38,9 +38,12 @@ Feature: Reek can be controlled using command-line options
38
38
  -c, --config FILE Read configuration options from FILE
39
39
 
40
40
  Report formatting:
41
- -q, --[no-]quiet Suppress headings for smell-free source files
42
- -n, --line-number Suppress line number(s) from the output.
41
+ -q, --quiet Suppress headings for smell-free source files (this is the default)
42
+ -V, --no-quiet, --verbose Show headings for smell-free source files
43
+ -n, --no-line-numbers Suppress line numbers from the output
44
+ --line-numbers Show line numbers in the output (this is the default)
43
45
  -s, --single-line Show IDE-compatible single-line-per-warning
46
+ -S, --sort-by-issue-count Sort by "issue-count", listing the "smelliest" files first
44
47
  -y, --yaml Report smells in YAML format
45
48
 
46
49
  """
@@ -1,50 +1,48 @@
1
1
  @smells_count
2
2
  Feature: Reports total number of code smells
3
- In order to monitor the total number of smells
4
- Reek outputs the total number of smells among all files inspected.
3
+ In order to monitor the total number of smells
4
+ Reek outputs the total number of smells among all files inspected.
5
5
 
6
- Scenario: Does not output total number of smells when inspecting single file
7
- When I run reek spec/samples/not_quite_masked/dirty.rb
8
- Then the exit status indicates smells
9
- And it reports:
10
- """
11
- spec/samples/not_quite_masked/dirty.rb -- 5 warnings:
12
- [7]:Dirty has the variable name '@s' (UncommunicativeVariableName)
13
- [6, 8]:Dirty#a calls @s.title twice (DuplicateMethodCall)
14
- [6, 8]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
15
- [7]:Dirty#a contains iterators nested 2 deep (NestedIterators)
16
- [5]:Dirty#a has the name 'a' (UncommunicativeMethodName)
17
- """
6
+ Scenario: Does not output total number of smells when inspecting single file
7
+ When I run reek spec/samples/not_quite_masked/dirty.rb
8
+ Then the exit status indicates smells
9
+ And it reports:
10
+ """
11
+ spec/samples/not_quite_masked/dirty.rb -- 5 warnings:
12
+ [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
13
+ [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
14
+ [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
15
+ [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
16
+ [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
17
+ """
18
18
 
19
- Scenario: Output total number of smells when inspecting multiple files
20
- When I run reek spec/samples/two_smelly_files
21
- Then the exit status indicates smells
22
- And it reports:
23
- """
24
- spec/samples/two_smelly_files/dirty_one.rb -- 6 warnings:
25
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
26
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
27
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
28
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
29
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
30
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
31
- spec/samples/two_smelly_files/dirty_two.rb -- 6 warnings:
32
- [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
33
- [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
34
- [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
35
- [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
36
- [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
37
- [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
38
- 12 total warnings
39
- """
19
+ Scenario: Output total number of smells when inspecting multiple files
20
+ When I run reek spec/samples/two_smelly_files
21
+ Then the exit status indicates smells
22
+ And it reports:
23
+ """
24
+ spec/samples/two_smelly_files/dirty_one.rb -- 6 warnings:
25
+ [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
26
+ [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
27
+ [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
28
+ [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
29
+ [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
30
+ [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
31
+ spec/samples/two_smelly_files/dirty_two.rb -- 6 warnings:
32
+ [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
33
+ [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
34
+ [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
35
+ [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
36
+ [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
37
+ [5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
38
+ 12 total warnings
39
+ """
40
40
 
41
- Scenario: Output total number of smells even if total equals 0
42
- When I run reek spec/samples/three_clean_files
43
- Then it succeeds
44
- And it reports:
45
- """
46
- spec/samples/three_clean_files/clean_one.rb -- 0 warnings
47
- spec/samples/three_clean_files/clean_three.rb -- 0 warnings
48
- spec/samples/three_clean_files/clean_two.rb -- 0 warnings
49
- 0 total warnings
50
- """
41
+ Scenario: Output total number of smells even if total equals 0
42
+ When I run reek spec/samples/three_clean_files
43
+ Then it succeeds
44
+ And it reports:
45
+ """
46
+
47
+ 0 total warnings
48
+ """
@@ -9,12 +9,15 @@ Feature: Reek reads from $stdin when no files are given
9
9
  Then it succeeds
10
10
  And it reports:
11
11
  """
12
- $stdin -- 0 warnings
13
-
14
12
  """
15
13
 
16
- Scenario: outputs header only on empty stdin
17
- When I pass "" to reek
14
+ Scenario: outputs nothing on empty stdin
15
+ When I pass "" to reek --quiet
16
+ Then it succeeds
17
+ And stdout equals ""
18
+
19
+ Scenario: outputs header only on empty stdin in verbose mode
20
+ When I pass "" to reek -V
18
21
  Then it succeeds
19
22
  And it reports:
20
23
  """
@@ -22,11 +25,6 @@ Feature: Reek reads from $stdin when no files are given
22
25
 
23
26
  """
24
27
 
25
- Scenario: outputs nothing on empty stdin in quiet mode
26
- When I pass "" to reek --quiet
27
- Then it succeeds
28
- And stdout equals ""
29
-
30
28
  Scenario: return non-zero status when there are smells
31
29
  When I pass "class Turn; def y() @x = 3; end end" to reek
32
30
  Then the exit status indicates smells
@@ -42,11 +40,7 @@ Feature: Reek reads from $stdin when no files are given
42
40
  @stderr
43
41
  Scenario: syntax error causes the source to be ignored
44
42
  When I pass "def incomplete" to reek
43
+ Then it reports a parsing error
45
44
  Then it succeeds
46
- And it reports:
47
- """
48
- $stdin -- 0 warnings
49
-
50
- """
51
- And it reports a parsing error
45
+ And stdout equals ""
52
46
 
@@ -6,7 +6,8 @@ Feature: Masking smells using config files
6
6
 
7
7
  Scenario: empty config file is ignored
8
8
  When I run reek spec/samples/empty_config_file/dirty.rb
9
- Then the exit status indicates smells
9
+ Then it reports the error 'Warning: Invalid configuration file "empty.reek" -- Empty file'
10
+ And the exit status indicates smells
10
11
  And it reports:
11
12
  """
12
13
  spec/samples/empty_config_file/dirty.rb -- 6 warnings:
@@ -20,19 +21,11 @@ Feature: Masking smells using config files
20
21
 
21
22
  Scenario: corrupt config file prevents normal output
22
23
  When I run reek spec/samples/corrupt_config_file
23
- Then the exit status indicates smells
24
+ Then it reports the error 'Error: Invalid configuration file "corrupt.reek" -- Not a hash'
25
+ And the exit status indicates an error
24
26
  And it reports:
25
27
  """
26
- spec/samples/corrupt_config_file/dirty.rb -- 7 warnings:
27
- [1]:Dirty has no descriptive comment (IrresponsibleModule)
28
- [4]:Dirty has the variable name '@s' (UncommunicativeVariableName)
29
- [3, 5]:Dirty#a calls @s.title twice (DuplicateMethodCall)
30
- [3, 5]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
31
- [4]:Dirty#a contains iterators nested 2 deep (NestedIterators)
32
- [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
33
- [4]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
34
28
  """
35
- And it reports an error
36
29
 
37
30
  Scenario: missing source file is an error
38
31
  When I run reek no_such_file.rb spec/samples/masked/dirty.rb
@@ -63,11 +56,11 @@ Feature: Masking smells using config files
63
56
  And it reports:
64
57
  """
65
58
  spec/samples/not_quite_masked/dirty.rb -- 5 warnings:
66
- [7]:Dirty has the variable name '@s' (UncommunicativeVariableName)
67
- [6, 8]:Dirty#a calls @s.title twice (DuplicateMethodCall)
68
- [6, 8]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
69
- [7]:Dirty#a contains iterators nested 2 deep (NestedIterators)
70
- [5]:Dirty#a has the name 'a' (UncommunicativeMethodName)
59
+ [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
60
+ [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
61
+ [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
62
+ [5]:Dirty#a contains iterators nested 2 deep (NestedIterators)
63
+ [3]:Dirty#a has the name 'a' (UncommunicativeMethodName)
71
64
  """
72
65
 
73
66
  @overrides
@@ -115,5 +108,4 @@ Feature: Masking smells using config files
115
108
  Then it succeeds
116
109
  And it reports:
117
110
  """
118
- spec/samples/masked/dirty.rb -- 0 warnings
119
111
  """
@@ -51,13 +51,14 @@ Feature: Reek can be driven through its Task
51
51
  """
52
52
  Reek::Rake::Task.new do |t|
53
53
  t.fail_on_error = false
54
- t.source_files = 'spec/samples/empty_config_file/dirty.rb'
54
+ t.source_files = 'spec/samples/no_config_file/dirty.rb'
55
55
  end
56
56
  """
57
- Then it succeeds
57
+ Then it reports no errors
58
+ And it succeeds
58
59
  And it reports:
59
60
  """
60
- spec/samples/empty_config_file/dirty.rb -- 6 warnings:
61
+ spec/samples/no_config_file/dirty.rb -- 6 warnings:
61
62
  [5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
62
63
  [4, 6]:Dirty#a calls @s.title twice (DuplicateMethodCall)
63
64
  [4, 6]:Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
@@ -77,5 +78,4 @@ Feature: Reek can be driven through its Task
77
78
  Then it succeeds
78
79
  And it reports:
79
80
  """
80
- spec/samples/masked/dirty.rb -- 0 warnings
81
81
  """
@@ -31,14 +31,57 @@ Feature: Correctly formatted reports
31
31
  | spec/samples/two_smelly_files/*.rb |
32
32
  | spec/samples/two_smelly_files |
33
33
 
34
- Scenario Outline: good files show headers consecutively
34
+ Scenario: Do not sort by default (which means report each file as it is read in)
35
+ When I run reek spec/samples/three_smelly_files/*.rb
36
+ Then the exit status indicates smells
37
+ And it reports:
38
+ """
39
+ spec/samples/three_smelly_files/dirty_one.rb -- 2 warnings:
40
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
41
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
42
+ spec/samples/three_smelly_files/dirty_three.rb -- 4 warnings:
43
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
44
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
45
+ [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
46
+ [4]:Dirty#c has the name 'c' (UncommunicativeMethodName)
47
+ spec/samples/three_smelly_files/dirty_two.rb -- 3 warnings:
48
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
49
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
50
+ [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
51
+ 9 total warnings
52
+ """
53
+
54
+ Scenario Outline: Sort by issue count
55
+ When I run reek <option> spec/samples/three_smelly_files/*.rb
56
+ Then the exit status indicates smells
57
+ And it reports:
58
+ """
59
+ spec/samples/three_smelly_files/dirty_three.rb -- 4 warnings:
60
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
61
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
62
+ [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
63
+ [4]:Dirty#c has the name 'c' (UncommunicativeMethodName)
64
+ spec/samples/three_smelly_files/dirty_two.rb -- 3 warnings:
65
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
66
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
67
+ [3]:Dirty#b has the name 'b' (UncommunicativeMethodName)
68
+ spec/samples/three_smelly_files/dirty_one.rb -- 2 warnings:
69
+ [1]:Dirty has no descriptive comment (IrresponsibleModule)
70
+ [2]:Dirty#a has the name 'a' (UncommunicativeMethodName)
71
+ 9 total warnings
72
+ """
73
+
74
+ Examples:
75
+ | option |
76
+ | -S |
77
+ | --sort-by-issue-count |
78
+
79
+ Scenario Outline: good files show no headers by default
35
80
  When I run reek <args>
36
81
  Then it succeeds
37
82
  And it reports:
38
83
  """
39
- spec/samples/three_clean_files/clean_one.rb -- 0 warnings
40
- spec/samples/three_clean_files/clean_three.rb -- 0 warnings
41
- spec/samples/three_clean_files/clean_two.rb -- 0 warnings
84
+
42
85
  0 total warnings
43
86
  """
44
87
 
@@ -47,20 +90,36 @@ Feature: Correctly formatted reports
47
90
  | spec/samples/three_clean_files/*.rb |
48
91
  | spec/samples/three_clean_files |
49
92
 
93
+ Scenario Outline: --verbose and --no-quiet turn on headers for fragrant files
94
+ When I run reek <option> spec/samples/three_clean_files/*.rb
95
+ Then it succeeds
96
+ And it reports:
97
+ """
98
+ spec/samples/three_clean_files/clean_one.rb -- 0 warnings
99
+ spec/samples/three_clean_files/clean_three.rb -- 0 warnings
100
+ spec/samples/three_clean_files/clean_two.rb -- 0 warnings
101
+ 0 total warnings
102
+ """
103
+
104
+ Examples:
105
+ | option |
106
+ | --verbose |
107
+ | -V |
108
+ | --no-quiet |
109
+
50
110
  Scenario Outline: --quiet turns off headers for fragrant files
51
111
  When I run reek <option> spec/samples/three_clean_files/*.rb
52
112
  Then it succeeds
53
113
  And it reports:
54
114
  """
115
+
55
116
  0 total warnings
56
117
  """
57
118
 
58
119
  Examples:
59
- | option |
60
- | -q |
61
- | --quiet |
62
- | -n -q |
63
- | -q -n |
120
+ | option |
121
+ | -V -q |
122
+ | -V --quiet |
64
123
 
65
124
  Scenario Outline: --line-number turns off line numbers
66
125
  When I run reek <option> spec/samples/not_quite_masked/dirty.rb
@@ -76,11 +135,11 @@ Feature: Correctly formatted reports
76
135
  """
77
136
 
78
137
  Examples:
79
- | option |
80
- | -n |
81
- | --line-number |
82
- | -n -q |
83
- | -q -n |
138
+ | option |
139
+ | -n |
140
+ | --no-line-numbers |
141
+ | -n -V |
142
+ | -V -n |
84
143
 
85
144
  Scenario Outline: --single-line shows filename and one line number
86
145
  When I run reek <option> spec/samples/not_quite_masked/dirty.rb
@@ -88,19 +147,19 @@ Feature: Correctly formatted reports
88
147
  And it reports:
89
148
  """
90
149
  spec/samples/not_quite_masked/dirty.rb -- 5 warnings:
91
- spec/samples/not_quite_masked/dirty.rb:7: Dirty has the variable name '@s' (UncommunicativeVariableName)
92
- spec/samples/not_quite_masked/dirty.rb:6: Dirty#a calls @s.title twice (DuplicateMethodCall)
93
- spec/samples/not_quite_masked/dirty.rb:6: Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
94
- spec/samples/not_quite_masked/dirty.rb:7: Dirty#a contains iterators nested 2 deep (NestedIterators)
95
- spec/samples/not_quite_masked/dirty.rb:5: Dirty#a has the name 'a' (UncommunicativeMethodName)
150
+ spec/samples/not_quite_masked/dirty.rb:5: Dirty has the variable name '@s' (UncommunicativeVariableName)
151
+ spec/samples/not_quite_masked/dirty.rb:4: Dirty#a calls @s.title twice (DuplicateMethodCall)
152
+ spec/samples/not_quite_masked/dirty.rb:4: Dirty#a calls puts(@s.title) twice (DuplicateMethodCall)
153
+ spec/samples/not_quite_masked/dirty.rb:5: Dirty#a contains iterators nested 2 deep (NestedIterators)
154
+ spec/samples/not_quite_masked/dirty.rb:3: Dirty#a has the name 'a' (UncommunicativeMethodName)
96
155
  """
97
156
 
98
157
  Examples:
99
158
  | option |
100
159
  | -s |
101
160
  | --single-line |
102
- | -s -q |
103
- | -q -s |
161
+ | -s -V |
162
+ | -V -s |
104
163
 
105
164
  Scenario Outline: Extra slashes aren't added to directory names
106
165
  When I run reek <args>
@@ -10,7 +10,7 @@ Feature: Basic smell detection
10
10
  Then the exit status indicates smells
11
11
  And it reports:
12
12
  """
13
- spec/samples/inline.rb -- 40 warnings:
13
+ spec/samples/inline.rb -- 39 warnings:
14
14
  File has no descriptive comment (IrresponsibleModule)
15
15
  Inline declares the class variable @@directory (ClassVariable)
16
16
  Inline declares the class variable @@rootdir (ClassVariable)
@@ -23,7 +23,7 @@ Feature: Basic smell detection
23
23
  Inline::C tests $DEBUG at least 7 times (RepeatedConditional)
24
24
  Inline::C tests $TESTING at least 4 times (RepeatedConditional)
25
25
  Inline::C tests @@type_map.has_key?(type) at least 3 times (RepeatedConditional)
26
- Inline::C#build calls $?.!=(0) twice (DuplicateMethodCall)
26
+ Inline::C#build calls ($? != 0) twice (DuplicateMethodCall)
27
27
  Inline::C#build calls Inline.directory 5 times (DuplicateMethodCall)
28
28
  Inline::C#build calls io.puts 6 times (DuplicateMethodCall)
29
29
  Inline::C#build calls io.puts("#endif") twice (DuplicateMethodCall)
@@ -50,7 +50,6 @@ Feature: Basic smell detection
50
50
  Inline::C#strip_comments refers to src more than self (FeatureEnvy)
51
51
  Module#inline calls Inline.const_get(lang) twice (DuplicateMethodCall)
52
52
  Module#inline has approx 11 statements (TooManyStatements)
53
- Module#inline is controlled by argument options (ControlParameter)
54
53
  """
55
54
 
56
55
  Scenario: Correct smells from optparse.rb
@@ -58,7 +57,7 @@ Feature: Basic smell detection
58
57
  Then the exit status indicates smells
59
58
  And it reports:
60
59
  """
61
- spec/samples/optparse.rb -- 109 warnings:
60
+ spec/samples/optparse.rb -- 103 warnings:
62
61
  OptionParser has at least 42 methods (TooManyMethods)
63
62
  OptionParser has the variable name 'f' (UncommunicativeVariableName)
64
63
  OptionParser has the variable name 'k' (UncommunicativeVariableName)
@@ -110,7 +109,6 @@ Feature: Basic smell detection
110
109
  OptionParser#parse_in_order calls sw.switch_name twice (DuplicateMethodCall)
111
110
  OptionParser#parse_in_order contains iterators nested 3 deep (NestedIterators)
112
111
  OptionParser#parse_in_order has approx 28 statements (TooManyStatements)
113
- OptionParser#parse_in_order is controlled by argument setter (ControlParameter)
114
112
  OptionParser#permute calls argv[0] twice (DuplicateMethodCall)
115
113
  OptionParser#permute refers to argv more than self (FeatureEnvy)
116
114
  OptionParser#search has the variable name 'k' (UncommunicativeVariableName)
@@ -118,6 +116,7 @@ Feature: Basic smell detection
118
116
  OptionParser#summarize has 4 parameters (LongParameterList)
119
117
  OptionParser#summarize has the variable name 'l' (UncommunicativeVariableName)
120
118
  OptionParser#ver has the variable name 'v' (UncommunicativeVariableName)
119
+ OptionParser::Arguable#options= is controlled by argument opt (ControlParameter)
121
120
  OptionParser::CompletingHash#match contains iterators nested 2 deep (NestedIterators)
122
121
  OptionParser::Completion#complete calls candidates.size twice (DuplicateMethodCall)
123
122
  OptionParser::Completion#complete calls k.id2name twice (DuplicateMethodCall)
@@ -128,7 +127,6 @@ Feature: Basic smell detection
128
127
  OptionParser::Completion#complete refers to candidates more than self (FeatureEnvy)
129
128
  OptionParser::Completion#convert has unused parameter 'opt' (UnusedParameters)
130
129
  OptionParser::List#accept has the parameter name 't' (UncommunicativeParameterName)
131
- OptionParser::List#accept is controlled by argument pat (ControlParameter)
132
130
  OptionParser::List#accept refers to pat more than self (FeatureEnvy)
133
131
  OptionParser::List#add_banner refers to opt more than self (FeatureEnvy)
134
132
  OptionParser::List#complete has 4 parameters (LongParameterList)
@@ -138,8 +136,6 @@ Feature: Basic smell detection
138
136
  OptionParser::List#update has 5 parameters (LongParameterList)
139
137
  OptionParser::List#update has approx 6 statements (TooManyStatements)
140
138
  OptionParser::List#update has the variable name 'o' (UncommunicativeVariableName)
141
- OptionParser::List#update is controlled by argument lopts (ControlParameter)
142
- OptionParser::List#update is controlled by argument sopts (ControlParameter)
143
139
  OptionParser::ParseError#set_option is controlled by argument eq (ControlParameter)
144
140
  OptionParser::Switch#add_banner has the variable name 's' (UncommunicativeVariableName)
145
141
  OptionParser::Switch#initialize has 7 parameters (LongParameterList)
@@ -163,11 +159,8 @@ Feature: Basic smell detection
163
159
  OptionParser::Switch#summarize has the variable name 'r' (UncommunicativeVariableName)
164
160
  OptionParser::Switch#summarize has the variable name 's' (UncommunicativeVariableName)
165
161
  OptionParser::Switch::NoArgument#parse has unused parameter 'argv' (UnusedParameters)
166
- OptionParser::Switch::NoArgument#parse is controlled by argument arg (ControlParameter)
167
162
  OptionParser::Switch::OptionalArgument#parse has unused parameter 'argv' (UnusedParameters)
168
- OptionParser::Switch::OptionalArgument#parse is controlled by argument arg (ControlParameter)
169
163
  OptionParser::Switch::PlacedArgument#parse has approx 6 statements (TooManyStatements)
170
- OptionParser::Switch::RequiredArgument#parse is controlled by argument arg (ControlParameter)
171
164
  """
172
165
 
173
166
  Scenario: Correct smells from redcloth.rb
@@ -175,7 +168,7 @@ Feature: Basic smell detection
175
168
  Then the exit status indicates smells
176
169
  And it reports:
177
170
  """
178
- spec/samples/redcloth.rb -- 101 warnings:
171
+ spec/samples/redcloth.rb -- 98 warnings:
179
172
  RedCloth has at least 44 methods (TooManyMethods)
180
173
  RedCloth has the variable name 'a' (UncommunicativeVariableName)
181
174
  RedCloth has the variable name 'b' (UncommunicativeVariableName)
@@ -207,7 +200,6 @@ Feature: Basic smell detection
207
200
  RedCloth#blocks has approx 18 statements (TooManyStatements)
208
201
  RedCloth#blocks has boolean parameter 'deep_code' (BooleanParameter)
209
202
  RedCloth#blocks is controlled by argument deep_code (ControlParameter)
210
- RedCloth#check_refs is controlled by argument text (ControlParameter)
211
203
  RedCloth#clean_html calls tags[tag] twice (DuplicateMethodCall)
212
204
  RedCloth#clean_html contains iterators nested 3 deep (NestedIterators)
213
205
  RedCloth#clean_html doesn't depend on instance state (UtilityFunction)
@@ -224,6 +216,7 @@ Feature: Basic smell detection
224
216
  RedCloth#footnote_ref refers to text more than self (FeatureEnvy)
225
217
  RedCloth#glyphs_textile has approx 10 statements (TooManyStatements)
226
218
  RedCloth#htmlesc doesn't depend on instance state (UtilityFunction)
219
+ RedCloth#htmlesc is controlled by argument mode (ControlParameter)
227
220
  RedCloth#htmlesc refers to str more than self (FeatureEnvy)
228
221
  RedCloth#incoming_entities refers to text more than self (FeatureEnvy)
229
222
  RedCloth#initialize has the variable name 'r' (UncommunicativeVariableName)
@@ -243,11 +236,12 @@ Feature: Basic smell detection
243
236
  RedCloth#inline_textile_span has approx 8 statements (TooManyStatements)
244
237
  RedCloth#inline_textile_span has the variable name 'm' (UncommunicativeVariableName)
245
238
  RedCloth#lT has the name 'lT' (UncommunicativeMethodName)
239
+ RedCloth#lT is controlled by argument text (ControlParameter)
246
240
  RedCloth#no_textile doesn't depend on instance state (UtilityFunction)
247
241
  RedCloth#no_textile refers to text more than self (FeatureEnvy)
248
242
  RedCloth#pba calls $1.length twice (DuplicateMethodCall)
249
243
  RedCloth#pba has approx 21 statements (TooManyStatements)
250
- RedCloth#pba is controlled by argument text_in (ControlParameter)
244
+ RedCloth#pba is controlled by argument element (ControlParameter)
251
245
  RedCloth#pba refers to style more than self (FeatureEnvy)
252
246
  RedCloth#pba refers to text more than self (FeatureEnvy)
253
247
  RedCloth#refs_markdown has the variable name 'm' (UncommunicativeVariableName)
@@ -265,15 +259,11 @@ Feature: Basic smell detection
265
259
  RedCloth#rip_offtags has approx 18 statements (TooManyStatements)
266
260
  RedCloth#textile_bq has 4 parameters (LongParameterList)
267
261
  RedCloth#textile_bq has unused parameter 'tag' (UnusedParameters)
268
- RedCloth#textile_bq is controlled by argument atts (ControlParameter)
269
- RedCloth#textile_bq is controlled by argument cite (ControlParameter)
270
262
  RedCloth#textile_fn_ has 5 parameters (LongParameterList)
271
263
  RedCloth#textile_fn_ has unused parameter 'cite' (UnusedParameters)
272
264
  RedCloth#textile_fn_ has unused parameter 'tag' (UnusedParameters)
273
- RedCloth#textile_fn_ is controlled by argument atts (ControlParameter)
274
265
  RedCloth#textile_p has 4 parameters (LongParameterList)
275
266
  RedCloth#textile_p has unused parameter 'cite' (UnusedParameters)
276
- RedCloth#textile_p is controlled by argument atts (ControlParameter)
277
267
  RedCloth#textile_popup_help has the parameter name 'windowH' (UncommunicativeParameterName)
278
268
  RedCloth#textile_popup_help has the parameter name 'windowW' (UncommunicativeParameterName)
279
269
  RedCloth#to_html has approx 24 statements (TooManyStatements)