reek 5.5.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -5
- data/.rubocop_todo.yml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +2 -2
- data/features/command_line_interface/options.feature +2 -2
- data/features/reports/json.feature +3 -3
- data/features/reports/reports.feature +4 -4
- data/features/reports/yaml.feature +3 -3
- data/features/support/env.rb +1 -1
- data/lib/reek/code_comment.rb +13 -13
- data/lib/reek/examiner.rb +3 -3
- data/lib/reek/report/text_report.rb +2 -2
- data/lib/reek/smell_detectors/subclassed_from_core_class.rb +3 -7
- data/lib/reek/version.rb +1 -1
- data/reek.gemspec +1 -1
- data/spec/factories/factories.rb +2 -2
- data/spec/reek/report/code_climate/code_climate_report_spec.rb +1 -1
- data/spec/reek/report/json_report_spec.rb +1 -1
- data/spec/reek/report/text_report_spec.rb +1 -7
- data/spec/reek/report/yaml_report_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da76dfc3aa1c997bffe832e526907dcf847cb5d86e04bc7c084abe074247e5d7
|
4
|
+
data.tar.gz: 7abc545f4176d0f561797c092bea15f1630b824a3d3ba37b99975450eb3ec3df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fe6f93cf2fe75c232327e1250c4e72c10c88707ce57879341f43b5a8a195ddb0282d9433e60cb19f635923edcb3fa52bbaadb187b5ee67d4b4cea7fc72ce901
|
7
|
+
data.tar.gz: a55abca10a6875077fda0b873667407f1dddf1840963fd6463ed918db9d9e58408fa93acf5a7e4741d9d488dede75963ad422c2150953e3d69f7af840a563dfd
|
data/.rubocop.yml
CHANGED
@@ -12,7 +12,7 @@ AllCops:
|
|
12
12
|
TargetRubyVersion: 2.3
|
13
13
|
|
14
14
|
# Tables are nice
|
15
|
-
Layout/
|
15
|
+
Layout/HashAlignment:
|
16
16
|
EnforcedColonStyle: table
|
17
17
|
EnforcedHashRocketStyle: table
|
18
18
|
EnforcedLastArgumentHashStyle: ignore_implicit
|
@@ -25,6 +25,10 @@ Layout/DotPosition:
|
|
25
25
|
Layout/EmptyLineBetweenDefs:
|
26
26
|
AllowAdjacentOneLineDefs: true
|
27
27
|
|
28
|
+
# Be rather lenient with line length
|
29
|
+
Layout/LineLength:
|
30
|
+
Max: 120
|
31
|
+
|
28
32
|
# Always put the closing brace on the last line
|
29
33
|
Layout/MultilineMethodCallBraceLayout:
|
30
34
|
EnforcedStyle: same_line
|
@@ -55,10 +59,6 @@ Metrics/BlockLength:
|
|
55
59
|
Exclude:
|
56
60
|
- 'spec/**/*'
|
57
61
|
|
58
|
-
# Be rather lenient with line length
|
59
|
-
Metrics/LineLength:
|
60
|
-
Max: 120
|
61
|
-
|
62
62
|
# Keyword arguments make long parameter lists readable
|
63
63
|
Metrics/ParameterLists:
|
64
64
|
CountKeywordArgs: false
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2019-12-22 13:19:30 +0100 using RuboCop version 0.78.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -15,7 +15,7 @@ Metrics/AbcSize:
|
|
15
15
|
Metrics/ClassLength:
|
16
16
|
Max: 161
|
17
17
|
|
18
|
-
# Offense count:
|
18
|
+
# Offense count: 14
|
19
19
|
# Configuration parameters: CountComments, ExcludedMethods.
|
20
20
|
Metrics/MethodLength:
|
21
21
|
Max: 16
|
@@ -55,8 +55,8 @@ RSpec/NestedGroups:
|
|
55
55
|
|
56
56
|
# Offense count: 2
|
57
57
|
# Cop supports --auto-correct.
|
58
|
-
# Configuration parameters: ConvertCodeThatCanStartToReturnNil,
|
59
|
-
#
|
58
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
|
59
|
+
# AllowedMethods: present?, blank?, presence, try, try!
|
60
60
|
Style/SafeNavigation:
|
61
61
|
Exclude:
|
62
62
|
- 'lib/reek/ast/node.rb'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -13,9 +13,9 @@ group :development do
|
|
13
13
|
gem 'rake', '~> 13.0'
|
14
14
|
gem 'rspec', '~> 3.0'
|
15
15
|
gem 'rspec-benchmark', '~> 0.5.0'
|
16
|
-
gem 'rubocop', '~> 0.
|
16
|
+
gem 'rubocop', '~> 0.79.0'
|
17
17
|
gem 'rubocop-performance', '~> 1.5.0'
|
18
|
-
gem 'rubocop-rspec', '~> 1.
|
18
|
+
gem 'rubocop-rspec', '~> 1.37.0'
|
19
19
|
gem 'simplecov', '~> 0.17.0'
|
20
20
|
gem 'yard', '~> 0.9.5'
|
21
21
|
|
@@ -43,7 +43,7 @@ Feature: Reek can be controlled using command-line options
|
|
43
43
|
-c, --config FILE Read configuration options from FILE
|
44
44
|
--smell SMELL Only look for a specific smell.
|
45
45
|
Call it like this: reek --smell MissingSafeMethod source.rb
|
46
|
-
Check out https://github.com/troessner/reek/blob/v5.
|
46
|
+
Check out https://github.com/troessner/reek/blob/v5.6.0/docs/Code-Smells.md for a list of smells
|
47
47
|
--stdin-filename FILE When passing code in via pipe, assume this filename when checking file or directory rules in the config.
|
48
48
|
|
49
49
|
Generate a todo list:
|
@@ -120,5 +120,5 @@ Feature: Reek can be controlled using command-line options
|
|
120
120
|
UnusedPrivateMethod
|
121
121
|
UtilityFunction
|
122
122
|
|
123
|
-
Check out https://github.com/troessner/reek/blob/v5.
|
123
|
+
Check out https://github.com/troessner/reek/blob/v5.6.0/docs/Code-Smells.md for a details on each detector
|
124
124
|
"""
|
@@ -24,7 +24,7 @@ Feature: Report smells using simple JSON layout
|
|
24
24
|
"context": "Smelly#x",
|
25
25
|
"lines": [ 4 ],
|
26
26
|
"message": "has the name 'x'",
|
27
|
-
"documentation_link": "https://github.com/troessner/reek/blob/v5.
|
27
|
+
"documentation_link": "https://github.com/troessner/reek/blob/v5.6.0/docs/Uncommunicative-Method-Name.md",
|
28
28
|
"name": "x"
|
29
29
|
},
|
30
30
|
{
|
@@ -33,7 +33,7 @@ Feature: Report smells using simple JSON layout
|
|
33
33
|
"context": "Smelly#x",
|
34
34
|
"lines": [ 5 ],
|
35
35
|
"message": "has the variable name 'y'",
|
36
|
-
"documentation_link": "https://github.com/troessner/reek/blob/v5.
|
36
|
+
"documentation_link": "https://github.com/troessner/reek/blob/v5.6.0/docs/Uncommunicative-Variable-Name.md",
|
37
37
|
"name": "y"
|
38
38
|
}
|
39
39
|
]
|
@@ -53,7 +53,7 @@ Feature: Report smells using simple JSON layout
|
|
53
53
|
1
|
54
54
|
],
|
55
55
|
"message": "has no descriptive comment",
|
56
|
-
"documentation_link": "https://github.com/troessner/reek/blob/v5.
|
56
|
+
"documentation_link": "https://github.com/troessner/reek/blob/v5.6.0/docs/Irresponsible-Module.md"
|
57
57
|
}
|
58
58
|
]
|
59
59
|
"""
|
@@ -182,8 +182,8 @@ Feature: Correctly formatted reports
|
|
182
182
|
And it reports:
|
183
183
|
"""
|
184
184
|
smelly.rb -- 2 warnings:
|
185
|
-
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/v5.
|
186
|
-
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v5.
|
185
|
+
[4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/v5.6.0/docs/Uncommunicative-Method-Name.md]
|
186
|
+
[5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v5.6.0/docs/Uncommunicative-Variable-Name.md]
|
187
187
|
"""
|
188
188
|
|
189
189
|
Examples:
|
@@ -209,8 +209,8 @@ Feature: Correctly formatted reports
|
|
209
209
|
And it reports:
|
210
210
|
"""
|
211
211
|
smelly.rb -- 2 warnings:
|
212
|
-
UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/v5.
|
213
|
-
UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v5.
|
212
|
+
UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/v5.6.0/docs/Uncommunicative-Method-Name.md]
|
213
|
+
UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v5.6.0/docs/Uncommunicative-Variable-Name.md]
|
214
214
|
"""
|
215
215
|
|
216
216
|
Examples:
|
@@ -25,7 +25,7 @@ Feature: Report smells using simple YAML layout
|
|
25
25
|
smell_type: UncommunicativeMethodName
|
26
26
|
source: smelly.rb
|
27
27
|
name: x
|
28
|
-
documentation_link: https://github.com/troessner/reek/blob/v5.
|
28
|
+
documentation_link: https://github.com/troessner/reek/blob/v5.6.0/docs/Uncommunicative-Method-Name.md
|
29
29
|
- context: Smelly#x
|
30
30
|
lines:
|
31
31
|
- 5
|
@@ -33,7 +33,7 @@ Feature: Report smells using simple YAML layout
|
|
33
33
|
smell_type: UncommunicativeVariableName
|
34
34
|
source: smelly.rb
|
35
35
|
name: y
|
36
|
-
documentation_link: https://github.com/troessner/reek/blob/v5.
|
36
|
+
documentation_link: https://github.com/troessner/reek/blob/v5.6.0/docs/Uncommunicative-Variable-Name.md
|
37
37
|
"""
|
38
38
|
|
39
39
|
Scenario: Indicate smells and print them as yaml when using STDIN
|
@@ -48,5 +48,5 @@ Feature: Report smells using simple YAML layout
|
|
48
48
|
lines:
|
49
49
|
- 1
|
50
50
|
message: has no descriptive comment
|
51
|
-
documentation_link: https://github.com/troessner/reek/blob/v5.
|
51
|
+
documentation_link: https://github.com/troessner/reek/blob/v5.6.0/docs/Irresponsible-Module.md
|
52
52
|
"""
|
data/features/support/env.rb
CHANGED
data/lib/reek/code_comment.rb
CHANGED
@@ -123,20 +123,20 @@ module Reek
|
|
123
123
|
def escalate_bad_detector
|
124
124
|
return if SmellDetectors::BaseDetector.valid_detector?(detector_name)
|
125
125
|
|
126
|
-
raise Errors::BadDetectorInCommentError
|
127
|
-
|
128
|
-
|
129
|
-
|
126
|
+
raise Errors::BadDetectorInCommentError.new(detector_name: detector_name,
|
127
|
+
original_comment: original_comment,
|
128
|
+
source: source,
|
129
|
+
line: line)
|
130
130
|
end
|
131
131
|
|
132
132
|
def escalate_bad_detector_configuration
|
133
133
|
@parsed_options = YAML.safe_load(options || CodeComment::DISABLE_DETECTOR_CONFIGURATION,
|
134
134
|
permitted_classes: [Regexp])
|
135
135
|
rescue Psych::SyntaxError
|
136
|
-
raise Errors::GarbageDetectorConfigurationInCommentError
|
137
|
-
|
138
|
-
|
139
|
-
|
136
|
+
raise Errors::GarbageDetectorConfigurationInCommentError.new(detector_name: detector_name,
|
137
|
+
original_comment: original_comment,
|
138
|
+
source: source,
|
139
|
+
line: line)
|
140
140
|
end
|
141
141
|
|
142
142
|
def escalate_unknown_configuration_key
|
@@ -144,11 +144,11 @@ module Reek
|
|
144
144
|
|
145
145
|
return if given_keys_legit?
|
146
146
|
|
147
|
-
raise Errors::BadDetectorConfigurationKeyInCommentError
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
147
|
+
raise Errors::BadDetectorConfigurationKeyInCommentError.new(detector_name: detector_name,
|
148
|
+
offensive_keys: configuration_keys_difference,
|
149
|
+
original_comment: original_comment,
|
150
|
+
source: source,
|
151
|
+
line: line)
|
152
152
|
end
|
153
153
|
|
154
154
|
# @return [Boolean] all keys in code comment are applicable to the detector in question
|
data/lib/reek/examiner.rb
CHANGED
@@ -105,11 +105,11 @@ module Reek
|
|
105
105
|
rescue Errors::BaseError
|
106
106
|
raise
|
107
107
|
rescue EncodingError
|
108
|
-
raise Errors::EncodingError
|
108
|
+
raise Errors::EncodingError.new(origin: origin)
|
109
109
|
rescue Parser::SyntaxError
|
110
|
-
raise Errors::SyntaxError
|
110
|
+
raise Errors::SyntaxError.new(origin: origin)
|
111
111
|
rescue StandardError
|
112
|
-
raise Errors::IncomprehensibleSourceError
|
112
|
+
raise Errors::IncomprehensibleSourceError.new(origin: origin)
|
113
113
|
end
|
114
114
|
|
115
115
|
def syntax_tree
|
@@ -43,13 +43,9 @@ module Reek
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def build_smell_warning(ancestor_name)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
parameters: { ancestor: ancestor_name }
|
50
|
-
}
|
51
|
-
|
52
|
-
smell_warning(smell_attributes)
|
46
|
+
smell_warning(lines: [source_line],
|
47
|
+
message: "inherits from core class '#{ancestor_name}'",
|
48
|
+
parameters: { ancestor: ancestor_name })
|
53
49
|
end
|
54
50
|
end
|
55
51
|
end
|
data/lib/reek/version.rb
CHANGED
data/reek.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_runtime_dependency 'codeclimate-engine-rb', '~> 0.4.0'
|
23
23
|
s.add_runtime_dependency 'kwalify', '~> 0.7.0'
|
24
|
-
s.add_runtime_dependency 'parser', '< 2.
|
24
|
+
s.add_runtime_dependency 'parser', '< 2.8', '>= 2.5.0.0', '!= 2.5.1.1'
|
25
25
|
s.add_runtime_dependency 'psych', '~> 3.1.0'
|
26
26
|
s.add_runtime_dependency 'rainbow', '>= 2.0', '< 4.0'
|
27
27
|
end
|
data/spec/factories/factories.rb
CHANGED
@@ -4,7 +4,7 @@ require_relative '../../lib/reek/smell_warning'
|
|
4
4
|
require_relative '../../lib/reek/cli/options'
|
5
5
|
|
6
6
|
FactoryBot.define do
|
7
|
-
factory :smell_warning, class: Reek::SmellWarning do
|
7
|
+
factory :smell_warning, class: 'Reek::SmellWarning' do
|
8
8
|
skip_create
|
9
9
|
|
10
10
|
smell_type { 'FeatureEnvy' }
|
@@ -24,7 +24,7 @@ FactoryBot.define do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
factory :code_comment, class: Reek::CodeComment do
|
27
|
+
factory :code_comment, class: 'Reek::CodeComment' do
|
28
28
|
comment { '' }
|
29
29
|
line { 1 }
|
30
30
|
source { 'string' }
|
@@ -6,13 +6,7 @@ require_lib 'reek/report/simple_warning_formatter'
|
|
6
6
|
require 'rainbow'
|
7
7
|
|
8
8
|
RSpec.describe Reek::Report::TextReport do
|
9
|
-
let(:
|
10
|
-
{
|
11
|
-
warning_formatter: Reek::Report::SimpleWarningFormatter.new,
|
12
|
-
heading_formatter: Reek::Report::QuietHeadingFormatter
|
13
|
-
}
|
14
|
-
end
|
15
|
-
let(:instance) { described_class.new report_options }
|
9
|
+
let(:instance) { described_class.new }
|
16
10
|
|
17
11
|
context 'with a single empty source' do
|
18
12
|
before do
|
data/spec/spec_helper.rb
CHANGED
@@ -11,7 +11,7 @@ require_relative '../samples/paths'
|
|
11
11
|
|
12
12
|
begin
|
13
13
|
Reek::CLI::Silencer.without_warnings { require 'pry-byebug' }
|
14
|
-
rescue LoadError # rubocop:disable Lint/
|
14
|
+
rescue LoadError # rubocop:disable Lint/SuppressedException
|
15
15
|
end
|
16
16
|
|
17
17
|
require 'factory_bot'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Rutherford
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2020-01-20 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: codeclimate-engine-rb
|
@@ -45,28 +45,28 @@ dependencies:
|
|
45
45
|
name: parser
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '2.8'
|
48
51
|
- - ">="
|
49
52
|
- !ruby/object:Gem::Version
|
50
53
|
version: 2.5.0.0
|
51
54
|
- - "!="
|
52
55
|
- !ruby/object:Gem::Version
|
53
56
|
version: 2.5.1.1
|
54
|
-
- - "<"
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '2.7'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
+
- - "<"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '2.8'
|
61
64
|
- - ">="
|
62
65
|
- !ruby/object:Gem::Version
|
63
66
|
version: 2.5.0.0
|
64
67
|
- - "!="
|
65
68
|
- !ruby/object:Gem::Version
|
66
69
|
version: 2.5.1.1
|
67
|
-
- - "<"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '2.7'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: psych
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -499,7 +499,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
499
499
|
- !ruby/object:Gem::Version
|
500
500
|
version: '0'
|
501
501
|
requirements: []
|
502
|
-
rubygems_version: 3.
|
502
|
+
rubygems_version: 3.1.2
|
503
503
|
signing_key:
|
504
504
|
specification_version: 4
|
505
505
|
summary: Code smell detector for Ruby
|