reek 3.3.1 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +3 -0
- data/README.md +12 -4
- data/Rakefile +1 -0
- data/config/defaults.reek +1 -2
- data/docs/Nested-Iterators.md +6 -1
- data/docs/Smell-Suppression.md +69 -5
- data/docs/Uncommunicative-Module-Name.md +1 -1
- data/docs/Utility-Function.md +13 -1
- data/docs/style-guide.md +18 -0
- data/docs/templates/default/docstring/html/public_api_marker.erb +3 -0
- data/docs/templates/default/docstring/setup.rb +41 -0
- data/docs/templates/default/fulldoc/html/css/common.css +1 -0
- data/docs/yard_plugin.rb +2 -0
- data/features/command_line_interface/smell_selection.feature +1 -0
- data/features/configuration_files/masking_smells.feature +12 -0
- data/features/samples.feature +27 -26
- data/features/step_definitions/sample_file_steps.rb +25 -30
- data/lib/reek/ast/ast_node_class_map.rb +1 -1
- data/lib/reek/ast/node.rb +3 -4
- data/lib/reek/ast/object_refs.rb +2 -2
- data/lib/reek/ast/reference_collector.rb +0 -1
- data/lib/reek/ast/sexp_extensions.rb +1 -2
- data/lib/reek/ast/sexp_formatter.rb +1 -2
- data/lib/reek/cli/application.rb +0 -1
- data/lib/reek/cli/command.rb +0 -1
- data/lib/reek/cli/input.rb +2 -1
- data/lib/reek/cli/option_interpreter.rb +0 -1
- data/lib/reek/cli/options.rb +3 -1
- data/lib/reek/cli/reek_command.rb +0 -1
- data/lib/reek/cli/silencer.rb +4 -4
- data/lib/reek/cli/warning_collector.rb +0 -1
- data/lib/reek/code_comment.rb +6 -11
- data/lib/reek/configuration/app_configuration.rb +0 -3
- data/lib/reek/configuration/configuration_file_finder.rb +4 -1
- data/lib/reek/configuration/configuration_validator.rb +1 -0
- data/lib/reek/configuration/directory_directives.rb +4 -0
- data/lib/reek/configuration/excluded_paths.rb +2 -1
- data/lib/reek/context/code_context.rb +11 -4
- data/lib/reek/context/method_context.rb +1 -6
- data/lib/reek/context/module_context.rb +0 -1
- data/lib/reek/context/root_context.rb +0 -1
- data/lib/reek/context/singleton_method_context.rb +0 -1
- data/lib/reek/examiner.rb +15 -15
- data/lib/reek/rake/task.rb +14 -0
- data/lib/reek/report.rb +0 -8
- data/lib/reek/report/formatter.rb +13 -12
- data/lib/reek/report/heading_formatter.rb +2 -1
- data/lib/reek/report/location_formatter.rb +0 -3
- data/lib/reek/report/report.rb +34 -14
- data/lib/reek/smells/attribute.rb +6 -6
- data/lib/reek/smells/boolean_parameter.rb +8 -8
- data/lib/reek/smells/class_variable.rb +7 -6
- data/lib/reek/smells/control_parameter.rb +8 -7
- data/lib/reek/smells/data_clump.rb +18 -20
- data/lib/reek/smells/duplicate_method_call.rb +10 -6
- data/lib/reek/smells/feature_envy.rb +17 -9
- data/lib/reek/smells/irresponsible_module.rb +6 -6
- data/lib/reek/smells/long_parameter_list.rb +7 -7
- data/lib/reek/smells/long_yield_list.rb +10 -9
- data/lib/reek/smells/module_initialize.rb +7 -6
- data/lib/reek/smells/nested_iterators.rb +5 -6
- data/lib/reek/smells/nil_check.rb +4 -5
- data/lib/reek/smells/prima_donna_method.rb +5 -5
- data/lib/reek/smells/repeated_conditional.rb +9 -6
- data/lib/reek/smells/smell_configuration.rb +1 -7
- data/lib/reek/smells/smell_detector.rb +28 -25
- data/lib/reek/smells/smell_repository.rb +18 -19
- data/lib/reek/smells/smell_warning.rb +34 -21
- data/lib/reek/smells/too_many_instance_variables.rb +5 -6
- data/lib/reek/smells/too_many_methods.rb +6 -6
- data/lib/reek/smells/too_many_statements.rb +5 -6
- data/lib/reek/smells/uncommunicative_method_name.rb +6 -6
- data/lib/reek/smells/uncommunicative_module_name.rb +36 -22
- data/lib/reek/smells/uncommunicative_parameter_name.rb +27 -19
- data/lib/reek/smells/uncommunicative_variable_name.rb +13 -7
- data/lib/reek/smells/unused_parameters.rb +10 -9
- data/lib/reek/smells/utility_function.rb +22 -11
- data/lib/reek/source/source_code.rb +11 -12
- data/lib/reek/source/source_locator.rb +6 -1
- data/lib/reek/spec.rb +11 -0
- data/lib/reek/spec/should_reek.rb +0 -3
- data/lib/reek/spec/should_reek_of.rb +1 -1
- data/lib/reek/spec/should_reek_only_of.rb +0 -1
- data/lib/reek/tree_dresser.rb +3 -1
- data/lib/reek/tree_walker.rb +4 -5
- data/lib/reek/version.rb +4 -1
- data/reek.gemspec +1 -1
- data/spec/factories/factories.rb +17 -6
- data/spec/quality/reek_source_spec.rb +3 -1
- data/spec/reek/cli/warning_collector_spec.rb +3 -2
- data/spec/reek/code_comment_spec.rb +8 -10
- data/spec/reek/configuration/directory_directives_spec.rb +2 -2
- data/spec/reek/configuration/excluded_paths_spec.rb +2 -2
- data/spec/reek/context/method_context_spec.rb +0 -26
- data/spec/reek/report/json_report_spec.rb +83 -6
- data/spec/reek/report/yaml_report_spec.rb +76 -6
- data/spec/reek/smells/attribute_spec.rb +1 -1
- data/spec/reek/smells/boolean_parameter_spec.rb +2 -3
- data/spec/reek/smells/class_variable_spec.rb +1 -1
- data/spec/reek/smells/control_parameter_spec.rb +1 -1
- data/spec/reek/smells/data_clump_spec.rb +1 -1
- data/spec/reek/smells/duplicate_method_call_spec.rb +1 -1
- data/spec/reek/smells/feature_envy_spec.rb +1 -0
- data/spec/reek/smells/irresponsible_module_spec.rb +1 -1
- data/spec/reek/smells/long_parameter_list_spec.rb +1 -1
- data/spec/reek/smells/long_yield_list_spec.rb +1 -1
- data/spec/reek/smells/nested_iterators_spec.rb +1 -1
- data/spec/reek/smells/repeated_conditional_spec.rb +1 -1
- data/spec/reek/smells/smell_configuration_spec.rb +9 -9
- data/spec/reek/smells/smell_detector_shared.rb +0 -9
- data/spec/reek/smells/smell_repository_spec.rb +1 -8
- data/spec/reek/smells/smell_warning_spec.rb +3 -2
- data/spec/reek/smells/too_many_instance_variables_spec.rb +1 -1
- data/spec/reek/smells/too_many_methods_spec.rb +2 -4
- data/spec/reek/smells/uncommunicative_method_name_spec.rb +1 -1
- data/spec/reek/smells/uncommunicative_module_name_spec.rb +22 -5
- data/spec/reek/smells/uncommunicative_parameter_name_spec.rb +1 -1
- data/spec/reek/smells/uncommunicative_variable_name_spec.rb +1 -1
- data/spec/reek/smells/utility_function_spec.rb +49 -0
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8492565566dc33ddd04e6474399de644c050c31
|
4
|
+
data.tar.gz: 40d22b046c4c8a9be279dae6aacd3859d7534d46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e929fb9f9a89fddb7383ed8fd606b22f31977ed43360160a3359cb325b7a56adbd4801ba7ded8993f90aae42f7369cda18be10b1ff2d44ed9181a2711affea84
|
7
|
+
data.tar.gz: ece84cae1ab3d23b457f7f31f6ce47ba48ea65683a82291645803020b418609137fbe5eae6185d1e706ae840a3cbc87a27de4d6abbbef624177cfc13373947e2
|
data/.rubocop.yml
CHANGED
@@ -18,6 +18,10 @@ Metrics/MethodLength:
|
|
18
18
|
Metrics/LineLength:
|
19
19
|
Max: 120
|
20
20
|
|
21
|
+
# Keyword arguments make long parameter lists readable
|
22
|
+
Metrics/ParameterLists:
|
23
|
+
CountKeywordArgs: false
|
24
|
+
|
21
25
|
# Indent one level for follow-up lines
|
22
26
|
Style/MultilineOperationIndentation:
|
23
27
|
EnforcedStyle: indented
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 3.4.0 (2015-09-16)
|
6
|
+
|
7
|
+
* (troessner) Make UtilityFunction configurable for non-public methods
|
8
|
+
* (troessner) Make FeatureEnvy and UtilityFunction messages more helpful
|
9
|
+
* (mvz) Mark public API @public
|
10
|
+
|
5
11
|
## 3.3.1 (2015-09-03)
|
6
12
|
|
7
13
|
* (troessner) Fix file list as argument in rake task
|
data/CONTRIBUTING.md
CHANGED
@@ -51,6 +51,9 @@ Once you’re sure your copy of reek works create your own feature branch from o
|
|
51
51
|
git checkout -b your_feature_or_fix_name
|
52
52
|
```
|
53
53
|
|
54
|
+
Make sure you have read our [style guide](docs/style-guide.md) before you
|
55
|
+
start contributing.
|
56
|
+
|
54
57
|
Then start hacking and add new tests which make sure that your new feature works or
|
55
58
|
demonstrate that your fix was needed; please also [write good commit
|
56
59
|
messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
data/README.md
CHANGED
@@ -204,9 +204,9 @@ configurations you can also check out [the `config/default.reek` file in this re
|
|
204
204
|
|
205
205
|
### Source code comments
|
206
206
|
|
207
|
-
|
208
|
-
|
209
|
-
|
207
|
+
In case you need to suppress a smell warning and you can't or don't want to
|
208
|
+
use configuration files for whatever reasons you can also use special
|
209
|
+
source code comments like this:
|
210
210
|
|
211
211
|
```Ruby
|
212
212
|
# This method smells of :reek:NestedIterators
|
@@ -215,8 +215,16 @@ def smelly_method foo
|
|
215
215
|
end
|
216
216
|
```
|
217
217
|
|
218
|
-
|
218
|
+
You can even pass in smell specific configuration settings:
|
219
219
|
|
220
|
+
```Ruby
|
221
|
+
# :reek:NestedIterators: { max_allowed_nesting: 2 }
|
222
|
+
def smelly_method foo
|
223
|
+
foo.each {|bar| bar.each {|baz| baz.qux}}
|
224
|
+
end
|
225
|
+
```
|
226
|
+
|
227
|
+
This is an incredible powerful feature and further explained under [Smell Suppresion](docs/Smell-Suppression.md).
|
220
228
|
|
221
229
|
## Usage
|
222
230
|
|
data/Rakefile
CHANGED
data/config/defaults.reek
CHANGED
data/docs/Nested-Iterators.md
CHANGED
@@ -36,4 +36,9 @@ Nested Iterators reports failing methods only once.
|
|
36
36
|
|
37
37
|
## Configuration
|
38
38
|
|
39
|
-
`Nested Iterators` offers the [Basic Smell Options](Basic-Smell-Options.md)
|
39
|
+
`Nested Iterators` offers the [Basic Smell Options](Basic-Smell-Options.md), plus:
|
40
|
+
|
41
|
+
| Option | Value | Effect |
|
42
|
+
| ---------------|-------------|---------|
|
43
|
+
| max_allowed_nesting | integer | The maximum depth of nested iterators. Defaults to 1 |
|
44
|
+
| ignore_iterators | Array | List of iterators to be excluded from the smell check. Includes only `tap` at the moment|
|
data/docs/Smell-Suppression.md
CHANGED
@@ -1,17 +1,23 @@
|
|
1
1
|
## Introduction
|
2
2
|
|
3
|
-
In some cases, it might be necessary to suppress one or more of `reek`'s smell
|
3
|
+
In some cases, it might be necessary to suppress one or more of `reek`'s smell
|
4
|
+
warnings for a particular method or class.
|
4
5
|
|
5
6
|
Possible reasons for this could be:
|
6
7
|
|
7
8
|
* The code is outside of your control and you can't fix it
|
8
|
-
* `reek` is not the police. You might have legit reasons why your source code
|
9
|
+
* `reek` is not the police. You might have legit reasons why your source code
|
10
|
+
is good as it is.
|
9
11
|
|
10
12
|
## How to disable smell detection
|
11
13
|
|
12
|
-
|
14
|
+
There are always the [Basic Smell Options](Basic-Smell-Options.md)
|
15
|
+
you can use in your configuration file.
|
13
16
|
|
14
|
-
|
17
|
+
But in this document we would like to focus on a completely different
|
18
|
+
way - via special comments.
|
19
|
+
|
20
|
+
A simple example:
|
15
21
|
|
16
22
|
```ruby
|
17
23
|
# This method smells of :reek:NestedIterators
|
@@ -20,7 +26,30 @@ def smelly_method foo
|
|
20
26
|
end
|
21
27
|
```
|
22
28
|
|
23
|
-
The method `smelly_method` will not be reported. The general pattern is to put
|
29
|
+
The method `smelly_method` will not be reported. The general pattern is to put
|
30
|
+
the string ':reek:', followed by the smell class, in a comment before the
|
31
|
+
method or class.
|
32
|
+
|
33
|
+
## Extended examples
|
34
|
+
|
35
|
+
Multiple smells may be configured for the same method or class:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
# :reek:LongParameterList and :reek:NestedIterators
|
39
|
+
def many_parameters_it_has foo, bar, baz, qux
|
40
|
+
foo.each {|bar| bar.each {|baz| baz.qux(qux)}}
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
Or across several lines which is arguably more readable:
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
# :reek:LongParameterList
|
48
|
+
# :reek:NestedIterators
|
49
|
+
def many_parameters_it_has foo, bar, baz, qux
|
50
|
+
foo.each {|bar| bar.each {|baz| baz.qux(qux)}}
|
51
|
+
end
|
52
|
+
```
|
24
53
|
|
25
54
|
It is also possible to specify options for a particular smell detector, like so:
|
26
55
|
|
@@ -30,3 +59,38 @@ def many_parameters_it_has foo, bar, baz, qux
|
|
30
59
|
# ...
|
31
60
|
end
|
32
61
|
```
|
62
|
+
|
63
|
+
Every configuration setting that you can pass via configuration file you can
|
64
|
+
also use via comment.
|
65
|
+
|
66
|
+
E.g.:
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
# :reek:TooManyStatements: { max_statements: 6 }
|
70
|
+
def too_many
|
71
|
+
# ...
|
72
|
+
end
|
73
|
+
|
74
|
+
# :reek:NestedIterators: { max_allowed_nesting: 2 }
|
75
|
+
def quax
|
76
|
+
foo.each {|bar| bar.each {|baz| baz.qux(qux)}}
|
77
|
+
end
|
78
|
+
|
79
|
+
# :reek:DuplicateMethodCall: { max_calls: 3 }
|
80
|
+
def quax
|
81
|
+
foo.to_i + foo.to_i + foo.to_i
|
82
|
+
end
|
83
|
+
```
|
84
|
+
|
85
|
+
Keep in mind that there are also smell detectors that operate on a class or
|
86
|
+
module level, e.g.:
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
# :reek:TooManyInstanceVariables: { max_instance_variables: 8 }
|
90
|
+
class Klass
|
91
|
+
# ...
|
92
|
+
end
|
93
|
+
```
|
94
|
+
|
95
|
+
To see what smell detector takes what special configuration just check out the
|
96
|
+
dedicated documentation for this smell detector.
|
@@ -20,4 +20,4 @@ Poor names make it hard for the reader to build a mental picture of what's going
|
|
20
20
|
| Option | Value | Effect |
|
21
21
|
| ---------------|-------------|---------|
|
22
22
|
| `reject` | array of regular expressions | The set of regular expressions that `reek` uses to check for bad names. Defaults to `[/^.$/, /[0-9]$/]`. |
|
23
|
-
| `accept` | array of strings
|
23
|
+
| `accept` | array of names as strings | List of names that will be accepted (not reported) even if they match one of the `reject` expressions. Empty by default.|
|
data/docs/Utility-Function.md
CHANGED
@@ -41,4 +41,16 @@ _[Feature Envy](Feature-Envy.md)_ is only triggered if there are some references
|
|
41
41
|
|
42
42
|
## Configuration
|
43
43
|
|
44
|
-
`reek`'s _Utility Function_ detector supports the [Basic Smell Options](Basic-Smell-Options.md)
|
44
|
+
`reek`'s _Utility Function_ detector supports the [Basic Smell Options](Basic-Smell-Options.md), plus:
|
45
|
+
|
46
|
+
| Option | Value | Effect |
|
47
|
+
| ---------------|-------------|---------|
|
48
|
+
| public_methods_only | Boolean | Disable this smell detector for non-public methods (which means "private" and "protected") |
|
49
|
+
|
50
|
+
A sample configuration file would look like this:
|
51
|
+
|
52
|
+
```Yaml
|
53
|
+
---
|
54
|
+
UtilityFunction:
|
55
|
+
public_methods_only: true
|
56
|
+
``
|
data/docs/style-guide.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Style guide
|
2
|
+
|
3
|
+
## Instance variables and getters / setters
|
4
|
+
|
5
|
+
We use instance vars only:
|
6
|
+
|
7
|
+
- in the constructor
|
8
|
+
- for [memoization](http://gavinmiller.io/2013/basics-of-ruby-memoization/)
|
9
|
+
|
10
|
+
For everything else we use proper getters / setters.
|
11
|
+
|
12
|
+
If possible those should be private. We use the [private_attr](https://github.com/jswanner/private_attr) for this, e.g.:
|
13
|
+
|
14
|
+
```Ruby
|
15
|
+
private_attr_reader :configuration
|
16
|
+
private_attr_writer :failure_message
|
17
|
+
private_attr_accessor :examiner
|
18
|
+
```
|
@@ -0,0 +1,41 @@
|
|
1
|
+
def init
|
2
|
+
super
|
3
|
+
return unless show_api_marker_section?
|
4
|
+
if sections.first
|
5
|
+
sections.first.place(:api_marker).before(:private)
|
6
|
+
else
|
7
|
+
sections :index, [:api_marker]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def api_marker
|
12
|
+
return if object.type == :root
|
13
|
+
case api_text
|
14
|
+
when 'public'
|
15
|
+
# erb(:public_api_marker)
|
16
|
+
when 'private'
|
17
|
+
# Let section 'private' handle this.
|
18
|
+
else
|
19
|
+
erb(:private)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def api_text
|
26
|
+
api_text = object.has_tag?(:api) && object.tag(:api).text
|
27
|
+
api_text = 'public' if object.has_tag?(:public)
|
28
|
+
api_text
|
29
|
+
end
|
30
|
+
|
31
|
+
def show_api_marker_section?
|
32
|
+
return false if object.type == :root
|
33
|
+
case api_text
|
34
|
+
when 'public'
|
35
|
+
false
|
36
|
+
when 'private'
|
37
|
+
false
|
38
|
+
else
|
39
|
+
true
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
.note.public { background: #c5ffc5; border-color: #aaecaa; }
|
data/docs/yard_plugin.rb
CHANGED
@@ -5,6 +5,7 @@ Feature: Smell selection
|
|
5
5
|
|
6
6
|
Scenario: --smell selects a smell to detect
|
7
7
|
Given a smelly file called 'smelly.rb'
|
8
|
+
And a configuration file masking some duplication smells called 'config.reek'
|
8
9
|
When I run reek --no-line-numbers --smell UncommunicativeMethodName smelly.rb
|
9
10
|
Then the exit status indicates smells
|
10
11
|
And it reports:
|
@@ -45,3 +45,15 @@ Feature: Masking smells using config files
|
|
45
45
|
[5]:Dirty has the variable name '@s' (UncommunicativeVariableName)
|
46
46
|
[5]:Dirty#a has the variable name 'x' (UncommunicativeVariableName)
|
47
47
|
"""
|
48
|
+
|
49
|
+
Scenario: Disable UtilityFunction for non-public methods
|
50
|
+
Given a smelly file called 'smelly.rb' with private, protected and public UtilityFunction methods
|
51
|
+
And a configuration file disabling UtilityFunction for non-public methods called 'config.reek'
|
52
|
+
When I run reek -c config.reek smelly.rb
|
53
|
+
Then the exit status indicates smells
|
54
|
+
And it reports:
|
55
|
+
"""
|
56
|
+
smelly.rb -- 1 warning:
|
57
|
+
[3]:Klass#public_method doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
58
|
+
"""
|
59
|
+
But it does not report private or protected methods
|
data/features/samples.feature
CHANGED
@@ -11,7 +11,7 @@ Feature: Basic smell detection
|
|
11
11
|
Then the exit status indicates smells
|
12
12
|
And it reports:
|
13
13
|
"""
|
14
|
-
inline.rb --
|
14
|
+
inline.rb -- 47 warnings:
|
15
15
|
CompilationError has no descriptive comment (IrresponsibleModule)
|
16
16
|
Dir has no descriptive comment (IrresponsibleModule)
|
17
17
|
File has no descriptive comment (IrresponsibleModule)
|
@@ -24,6 +24,7 @@ Feature: Basic smell detection
|
|
24
24
|
Inline::C declares the class variable @@type_map (ClassVariable)
|
25
25
|
Inline::C has at least 13 instance variables (TooManyInstanceVariables)
|
26
26
|
Inline::C has at least 25 methods (TooManyMethods)
|
27
|
+
Inline::C has the name 'C' (UncommunicativeModuleName)
|
27
28
|
Inline::C takes parameters [options, src] to 5 methods (DataClump)
|
28
29
|
Inline::C tests $DEBUG at least 7 times (RepeatedConditional)
|
29
30
|
Inline::C tests $TESTING at least 4 times (RepeatedConditional)
|
@@ -53,7 +54,7 @@ Feature: Basic smell detection
|
|
53
54
|
Inline::C#parse_signature has boolean parameter 'raw' (BooleanParameter)
|
54
55
|
Inline::C#parse_signature has the variable name 'x' (UncommunicativeVariableName)
|
55
56
|
Inline::C#parse_signature is controlled by argument raw (ControlParameter)
|
56
|
-
Inline::C#strip_comments doesn't depend on instance state (UtilityFunction)
|
57
|
+
Inline::C#strip_comments doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
57
58
|
Module has no descriptive comment (IrresponsibleModule)
|
58
59
|
Module#inline calls Inline.const_get(lang) 2 times (DuplicateMethodCall)
|
59
60
|
Module#inline calls options[:testing] 2 times (DuplicateMethodCall)
|
@@ -103,9 +104,9 @@ Feature: Basic smell detection
|
|
103
104
|
OptionParser#make_switch has the variable name 'v' (UncommunicativeVariableName)
|
104
105
|
OptionParser#make_switch performs a nil-check (NilCheck)
|
105
106
|
OptionParser#order calls argv[0] 2 times (DuplicateMethodCall)
|
106
|
-
OptionParser#order refers to argv more than self (FeatureEnvy)
|
107
|
+
OptionParser#order refers to argv more than self (maybe move it to another class?) (FeatureEnvy)
|
107
108
|
OptionParser#parse calls argv[0] 2 times (DuplicateMethodCall)
|
108
|
-
OptionParser#parse refers to argv more than self (FeatureEnvy)
|
109
|
+
OptionParser#parse refers to argv more than self (maybe move it to another class?) (FeatureEnvy)
|
109
110
|
OptionParser#parse_in_order calls $!.set_option(arg, true) 2 times (DuplicateMethodCall)
|
110
111
|
OptionParser#parse_in_order calls cb.call(val) 2 times (DuplicateMethodCall)
|
111
112
|
OptionParser#parse_in_order calls raise($!.set_option(arg, true)) 2 times (DuplicateMethodCall)
|
@@ -116,7 +117,7 @@ Feature: Basic smell detection
|
|
116
117
|
OptionParser#parse_in_order contains iterators nested 3 deep (NestedIterators)
|
117
118
|
OptionParser#parse_in_order has approx 35 statements (TooManyStatements)
|
118
119
|
OptionParser#permute calls argv[0] 2 times (DuplicateMethodCall)
|
119
|
-
OptionParser#permute refers to argv more than self (FeatureEnvy)
|
120
|
+
OptionParser#permute refers to argv more than self (maybe move it to another class?) (FeatureEnvy)
|
120
121
|
OptionParser#permute! has approx 6 statements (TooManyStatements)
|
121
122
|
OptionParser#program_name is a writable attribute (Attribute)
|
122
123
|
OptionParser#release is a writable attribute (Attribute)
|
@@ -139,15 +140,15 @@ Feature: Basic smell detection
|
|
139
140
|
OptionParser::Completion#complete has boolean parameter 'icase' (BooleanParameter)
|
140
141
|
OptionParser::Completion#complete has the variable name 'k' (UncommunicativeVariableName)
|
141
142
|
OptionParser::Completion#complete has the variable name 'v' (UncommunicativeVariableName)
|
142
|
-
OptionParser::Completion#complete refers to candidates more than self (FeatureEnvy)
|
143
|
+
OptionParser::Completion#complete refers to candidates more than self (maybe move it to another class?) (FeatureEnvy)
|
143
144
|
OptionParser::Completion#convert has unused parameter 'opt' (UnusedParameters)
|
144
145
|
OptionParser::List#accept has the parameter name 't' (UncommunicativeParameterName)
|
145
|
-
OptionParser::List#accept refers to pat more than self (FeatureEnvy)
|
146
|
-
OptionParser::List#add_banner refers to opt more than self (FeatureEnvy)
|
146
|
+
OptionParser::List#accept refers to pat more than self (maybe move it to another class?) (FeatureEnvy)
|
147
|
+
OptionParser::List#add_banner refers to opt more than self (maybe move it to another class?) (FeatureEnvy)
|
147
148
|
OptionParser::List#complete has 4 parameters (LongParameterList)
|
148
149
|
OptionParser::List#complete has boolean parameter 'icase' (BooleanParameter)
|
149
150
|
OptionParser::List#reject has the parameter name 't' (UncommunicativeParameterName)
|
150
|
-
OptionParser::List#summarize refers to opt more than self (FeatureEnvy)
|
151
|
+
OptionParser::List#summarize refers to opt more than self (maybe move it to another class?) (FeatureEnvy)
|
151
152
|
OptionParser::List#update has 5 parameters (LongParameterList)
|
152
153
|
OptionParser::List#update has approx 10 statements (TooManyStatements)
|
153
154
|
OptionParser::List#update has the variable name 'o' (UncommunicativeVariableName)
|
@@ -189,11 +190,11 @@ Feature: Basic smell detection
|
|
189
190
|
RedCloth tests codepre.zero? at least 3 times (RepeatedConditional)
|
190
191
|
RedCloth tests href at least 3 times (RepeatedConditional)
|
191
192
|
RedCloth tests title at least 4 times (RepeatedConditional)
|
192
|
-
RedCloth#block_markdown_atx refers to text more than self (FeatureEnvy)
|
193
|
+
RedCloth#block_markdown_atx refers to text more than self (maybe move it to another class?) (FeatureEnvy)
|
193
194
|
RedCloth#block_markdown_bq has approx 6 statements (TooManyStatements)
|
194
195
|
RedCloth#block_markdown_lists has unused parameter 'text' (UnusedParameters)
|
195
|
-
RedCloth#block_markdown_rule doesn't depend on instance state (UtilityFunction)
|
196
|
-
RedCloth#block_markdown_setext refers to text more than self (FeatureEnvy)
|
196
|
+
RedCloth#block_markdown_rule doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
197
|
+
RedCloth#block_markdown_setext refers to text more than self (maybe move it to another class?) (FeatureEnvy)
|
197
198
|
RedCloth#block_textile_lists calls depth.last 5 times (DuplicateMethodCall)
|
198
199
|
RedCloth#block_textile_lists calls depth.last.length 2 times (DuplicateMethodCall)
|
199
200
|
RedCloth#block_textile_lists calls depth[i] 2 times (DuplicateMethodCall)
|
@@ -204,7 +205,7 @@ Feature: Basic smell detection
|
|
204
205
|
RedCloth#block_textile_lists has approx 21 statements (TooManyStatements)
|
205
206
|
RedCloth#block_textile_lists has the variable name 'i' (UncommunicativeVariableName)
|
206
207
|
RedCloth#block_textile_lists has the variable name 'v' (UncommunicativeVariableName)
|
207
|
-
RedCloth#block_textile_lists refers to depth more than self (FeatureEnvy)
|
208
|
+
RedCloth#block_textile_lists refers to depth more than self (maybe move it to another class?) (FeatureEnvy)
|
208
209
|
RedCloth#block_textile_table contains iterators nested 3 deep (NestedIterators)
|
209
210
|
RedCloth#block_textile_table has approx 19 statements (TooManyStatements)
|
210
211
|
RedCloth#block_textile_table has the variable name 'x' (UncommunicativeVariableName)
|
@@ -212,25 +213,25 @@ Feature: Basic smell detection
|
|
212
213
|
RedCloth#blocks has approx 19 statements (TooManyStatements)
|
213
214
|
RedCloth#blocks has boolean parameter 'deep_code' (BooleanParameter)
|
214
215
|
RedCloth#blocks is controlled by argument deep_code (ControlParameter)
|
215
|
-
RedCloth#blocks refers to blk more than self (FeatureEnvy)
|
216
|
+
RedCloth#blocks refers to blk more than self (maybe move it to another class?) (FeatureEnvy)
|
216
217
|
RedCloth#clean_html calls tags[tag] 2 times (DuplicateMethodCall)
|
217
218
|
RedCloth#clean_html contains iterators nested 3 deep (NestedIterators)
|
218
|
-
RedCloth#clean_html doesn't depend on instance state (UtilityFunction)
|
219
|
+
RedCloth#clean_html doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
219
220
|
RedCloth#clean_html has approx 15 statements (TooManyStatements)
|
220
221
|
RedCloth#clean_html has the variable name 'q' (UncommunicativeVariableName)
|
221
222
|
RedCloth#clean_html has the variable name 'q2' (UncommunicativeVariableName)
|
222
223
|
RedCloth#clean_white_space has approx 7 statements (TooManyStatements)
|
223
|
-
RedCloth#clean_white_space refers to text more than self (FeatureEnvy)
|
224
|
+
RedCloth#clean_white_space refers to text more than self (maybe move it to another class?) (FeatureEnvy)
|
224
225
|
RedCloth#filter_html is a writable attribute (Attribute)
|
225
226
|
RedCloth#filter_styles is a writable attribute (Attribute)
|
226
|
-
RedCloth#flush_left doesn't depend on instance state (UtilityFunction)
|
227
|
-
RedCloth#footnote_ref doesn't depend on instance state (UtilityFunction)
|
227
|
+
RedCloth#flush_left doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
228
|
+
RedCloth#footnote_ref doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
228
229
|
RedCloth#glyphs_textile has approx 10 statements (TooManyStatements)
|
229
|
-
RedCloth#h_align doesn't depend on instance state (UtilityFunction)
|
230
|
+
RedCloth#h_align doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
230
231
|
RedCloth#hard_breaks is a writable attribute (Attribute)
|
231
|
-
RedCloth#htmlesc doesn't depend on instance state (UtilityFunction)
|
232
|
+
RedCloth#htmlesc doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
232
233
|
RedCloth#htmlesc is controlled by argument mode (ControlParameter)
|
233
|
-
RedCloth#incoming_entities doesn't depend on instance state (UtilityFunction)
|
234
|
+
RedCloth#incoming_entities doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
234
235
|
RedCloth#initialize has the variable name 'r' (UncommunicativeVariableName)
|
235
236
|
RedCloth#inline contains iterators nested 2 deep (NestedIterators)
|
236
237
|
RedCloth#inline_markdown_link has approx 6 statements (TooManyStatements)
|
@@ -247,16 +248,16 @@ Feature: Basic smell detection
|
|
247
248
|
RedCloth#inline_textile_span contains iterators nested 2 deep (NestedIterators)
|
248
249
|
RedCloth#inline_textile_span has approx 9 statements (TooManyStatements)
|
249
250
|
RedCloth#inline_textile_span has the variable name 'm' (UncommunicativeVariableName)
|
250
|
-
RedCloth#lT doesn't depend on instance state (UtilityFunction)
|
251
|
+
RedCloth#lT doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
251
252
|
RedCloth#lT has the name 'lT' (UncommunicativeMethodName)
|
252
253
|
RedCloth#lT is controlled by argument text (ControlParameter)
|
253
254
|
RedCloth#lite_mode is a writable attribute (Attribute)
|
254
255
|
RedCloth#no_span_caps is a writable attribute (Attribute)
|
255
|
-
RedCloth#no_textile doesn't depend on instance state (UtilityFunction)
|
256
|
+
RedCloth#no_textile doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
256
257
|
RedCloth#pba calls $1.length 2 times (DuplicateMethodCall)
|
257
258
|
RedCloth#pba has approx 21 statements (TooManyStatements)
|
258
259
|
RedCloth#pba is controlled by argument element (ControlParameter)
|
259
|
-
RedCloth#pba refers to text more than self (FeatureEnvy)
|
260
|
+
RedCloth#pba refers to text more than self (maybe move it to another class?) (FeatureEnvy)
|
260
261
|
RedCloth#refs_markdown has the variable name 'm' (UncommunicativeVariableName)
|
261
262
|
RedCloth#refs_textile has the variable name 'm' (UncommunicativeVariableName)
|
262
263
|
RedCloth#retrieve has the variable name 'i' (UncommunicativeVariableName)
|
@@ -281,6 +282,6 @@ Feature: Basic smell detection
|
|
281
282
|
RedCloth#textile_popup_help has the parameter name 'windowH' (UncommunicativeParameterName)
|
282
283
|
RedCloth#textile_popup_help has the parameter name 'windowW' (UncommunicativeParameterName)
|
283
284
|
RedCloth#to_html has approx 26 statements (TooManyStatements)
|
284
|
-
RedCloth#v_align doesn't depend on instance state (UtilityFunction)
|
285
|
-
|
285
|
+
RedCloth#v_align doesn't depend on instance state (maybe move it to another class?) (UtilityFunction)
|
286
|
+
269 total warnings
|
286
287
|
"""
|