reek 4.7.2 → 4.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +18 -4
- data/.travis.yml +0 -5
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +4 -4
- data/docs/How-To-Write-New-Detectors.md +6 -5
- data/docs/Unused-Private-Method.md +1 -1
- data/features/configuration_via_source_comments/erroneous_source_comments.feature +1 -1
- data/features/locales.feature +32 -0
- data/features/rake_task/rake_task.feature +46 -6
- data/features/rspec_matcher.feature +32 -0
- data/features/step_definitions/reek_steps.rb +0 -4
- data/features/support/env.rb +0 -9
- data/lib/reek/ast/builder.rb +1 -1
- data/lib/reek/ast/sexp_extensions/send.rb +0 -4
- data/lib/reek/cli/options.rb +2 -2
- data/lib/reek/configuration/app_configuration.rb +3 -2
- data/lib/reek/configuration/configuration_file_finder.rb +3 -3
- data/lib/reek/context/ghost_context.rb +0 -2
- data/lib/reek/context/module_context.rb +0 -3
- data/lib/reek/context_builder.rb +2 -4
- data/lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb +2 -2
- data/lib/reek/errors/bad_detector_in_comment_error.rb +2 -2
- data/lib/reek/errors/encoding_error.rb +38 -0
- data/lib/reek/errors/garbage_detector_configuration_in_comment_error.rb +3 -3
- data/lib/reek/errors/incomprehensible_source_error.rb +4 -4
- data/lib/reek/examiner.rb +15 -11
- data/lib/reek/rake/task.rb +5 -1
- data/lib/reek/smell_detectors/attribute.rb +6 -11
- data/lib/reek/smell_detectors/base_detector.rb +9 -1
- data/lib/reek/smell_detectors/boolean_parameter.rb +4 -5
- data/lib/reek/smell_detectors/class_variable.rb +5 -6
- data/lib/reek/smell_detectors/control_parameter.rb +3 -3
- data/lib/reek/smell_detectors/data_clump.rb +13 -6
- data/lib/reek/smell_detectors/duplicate_method_call.rb +18 -11
- data/lib/reek/smell_detectors/feature_envy.rb +9 -7
- data/lib/reek/smell_detectors/instance_variable_assumption.rb +14 -14
- data/lib/reek/smell_detectors/irresponsible_module.rb +6 -12
- data/lib/reek/smell_detectors/long_parameter_list.rb +10 -6
- data/lib/reek/smell_detectors/long_yield_list.rb +9 -5
- data/lib/reek/smell_detectors/manual_dispatch.rb +3 -4
- data/lib/reek/smell_detectors/module_initialize.rb +4 -5
- data/lib/reek/smell_detectors/nested_iterators.rb +11 -19
- data/lib/reek/smell_detectors/nil_check.rb +9 -15
- data/lib/reek/smell_detectors/prima_donna_method.rb +17 -16
- data/lib/reek/smell_detectors/repeated_conditional.rb +11 -8
- data/lib/reek/smell_detectors/subclassed_from_core_class.rb +8 -8
- data/lib/reek/smell_detectors/too_many_constants.rb +10 -8
- data/lib/reek/smell_detectors/too_many_instance_variables.rb +10 -5
- data/lib/reek/smell_detectors/too_many_methods.rb +11 -6
- data/lib/reek/smell_detectors/too_many_statements.rb +10 -5
- data/lib/reek/smell_detectors/uncommunicative_method_name.rb +8 -8
- data/lib/reek/smell_detectors/uncommunicative_module_name.rb +12 -15
- data/lib/reek/smell_detectors/uncommunicative_parameter_name.rb +10 -13
- data/lib/reek/smell_detectors/uncommunicative_variable_name.rb +23 -23
- data/lib/reek/smell_detectors/unused_parameters.rb +5 -6
- data/lib/reek/smell_detectors/unused_private_method.rb +11 -18
- data/lib/reek/smell_detectors/utility_function.rb +12 -15
- data/lib/reek/source/source_code.rb +27 -6
- data/lib/reek/source/source_locator.rb +1 -1
- data/lib/reek/spec.rb +1 -1
- data/lib/reek/version.rb +1 -1
- data/reek.gemspec +0 -2
- data/spec/reek/ast/sexp_extensions_spec.rb +12 -32
- data/spec/reek/cli/application_spec.rb +4 -6
- data/spec/reek/configuration/configuration_file_finder_spec.rb +0 -2
- data/spec/reek/examiner_spec.rb +38 -1
- data/spec/reek/rake/task_spec.rb +25 -2
- data/spec/reek/smell_detectors/base_detector_spec.rb +4 -5
- data/spec/reek/smell_detectors/prima_donna_method_spec.rb +3 -3
- data/spec/reek/source/source_code_spec.rb +28 -1
- data/spec/reek/spec/should_reek_of_spec.rb +18 -18
- data/spec/reek/spec/should_reek_spec.rb +5 -5
- data/spec/reek/spec/smell_matcher_spec.rb +20 -20
- data/spec/spec_helper.rb +1 -1
- metadata +6 -3
@@ -8,11 +8,11 @@ RSpec.describe Reek::Spec::ShouldReek do
|
|
8
8
|
let(:smelly_code) { 'def x() y = 4; end' }
|
9
9
|
|
10
10
|
it 'matches a smelly String' do
|
11
|
-
expect(matcher.
|
11
|
+
expect(matcher).to be_matches(smelly_code)
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'doesnt match a fragrant String' do
|
15
|
-
expect(matcher.
|
15
|
+
expect(matcher).not_to be_matches(clean_code)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'reports the smells when should_not fails' do
|
@@ -26,11 +26,11 @@ RSpec.describe Reek::Spec::ShouldReek do
|
|
26
26
|
let(:matcher) { described_class.new }
|
27
27
|
|
28
28
|
it 'matches a smelly File' do
|
29
|
-
expect(matcher.
|
29
|
+
expect(matcher).to be_matches(SMELLY_FILE)
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'doesnt match a fragrant File' do
|
33
|
-
expect(matcher.
|
33
|
+
expect(matcher).not_to be_matches(CLEAN_FILE)
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'reports the smells when should_not fails' do
|
@@ -45,7 +45,7 @@ RSpec.describe Reek::Spec::ShouldReek do
|
|
45
45
|
let(:matcher) { described_class.new(configuration: configuration) }
|
46
46
|
|
47
47
|
it 'masks smells using the relevant configuration' do
|
48
|
-
expect(matcher.
|
48
|
+
expect(matcher).not_to be_matches(SMELLY_FILE)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -12,33 +12,33 @@ RSpec.describe Reek::Spec::SmellMatcher do
|
|
12
12
|
|
13
13
|
context '#matches?' do
|
14
14
|
it 'matches on class symbol' do
|
15
|
-
expect(matcher.
|
15
|
+
expect(matcher).to be_matches(:UncommunicativeVariableName)
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'matches on class symbol and params' do
|
19
|
-
expect(matcher.
|
20
|
-
|
19
|
+
expect(matcher).to be_matches(:UncommunicativeVariableName,
|
20
|
+
test: 'something')
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'matches on class symbol, params and attributes' do
|
24
|
-
expect(matcher.
|
25
|
-
|
26
|
-
|
24
|
+
expect(matcher).to be_matches(:UncommunicativeVariableName,
|
25
|
+
test: 'something',
|
26
|
+
message: "has the variable name '@s'")
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'does not match on different class symbol' do
|
30
|
-
expect(matcher.
|
30
|
+
expect(matcher).not_to be_matches(:FeatureEnvy)
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'does not match on different params' do
|
34
|
-
expect(matcher.
|
35
|
-
|
34
|
+
expect(matcher).not_to be_matches(:UncommunicativeVariableName,
|
35
|
+
test: 'something else')
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'does not match on different attributes' do
|
39
|
-
expect(matcher.
|
40
|
-
|
41
|
-
|
39
|
+
expect(matcher).not_to be_matches(:UncommunicativeVariableName,
|
40
|
+
test: 'something',
|
41
|
+
message: 'nothing')
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'raises error on uncomparable attribute' do
|
@@ -52,31 +52,31 @@ RSpec.describe Reek::Spec::SmellMatcher do
|
|
52
52
|
|
53
53
|
context '#matches_smell_type?' do
|
54
54
|
it 'matches on class symbol' do
|
55
|
-
expect(matcher.
|
55
|
+
expect(matcher).to be_matches_smell_type(:UncommunicativeVariableName)
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'does not match on different class symbol' do
|
59
|
-
expect(matcher.
|
59
|
+
expect(matcher).not_to be_matches_smell_type(:FeatureEnvy)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
context '#matches_attributes?' do
|
64
64
|
it 'matches on params' do
|
65
|
-
expect(matcher.
|
65
|
+
expect(matcher).to be_matches_attributes(test: 'something')
|
66
66
|
end
|
67
67
|
|
68
68
|
it 'matches on class symbol, params and attributes' do
|
69
|
-
expect(matcher.
|
70
|
-
|
69
|
+
expect(matcher).to be_matches_attributes(test: 'something',
|
70
|
+
message: "has the variable name '@s'")
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'does not match on different params' do
|
74
|
-
expect(matcher.
|
74
|
+
expect(matcher).not_to be_matches_attributes(test: 'something else')
|
75
75
|
end
|
76
76
|
|
77
77
|
it 'does not match on different attributes' do
|
78
|
-
expect(matcher.
|
79
|
-
|
78
|
+
expect(matcher).not_to be_matches_attributes(test: 'something',
|
79
|
+
message: 'nothing')
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'raises error on uncomparable attribute' do
|
data/spec/spec_helper.rb
CHANGED
@@ -90,7 +90,7 @@ RSpec.configure do |config|
|
|
90
90
|
# mutation tester. Set the DEBUG environment variable to something truthy
|
91
91
|
# like '1' to disable this and allow using pry without specs failing.
|
92
92
|
unless ENV['DEBUG']
|
93
|
-
config.around
|
93
|
+
config.around do |example|
|
94
94
|
Timeout.timeout(5, &example)
|
95
95
|
end
|
96
96
|
end
|
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: 4.7.
|
4
|
+
version: 4.7.3
|
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: 2017-
|
14
|
+
date: 2017-11-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: codeclimate-engine-rb
|
@@ -160,12 +160,14 @@ files:
|
|
160
160
|
- features/configuration_loading.feature
|
161
161
|
- features/configuration_via_source_comments/erroneous_source_comments.feature
|
162
162
|
- features/configuration_via_source_comments/well_formed_source_comments.feature
|
163
|
+
- features/locales.feature
|
163
164
|
- features/programmatic_access.feature
|
164
165
|
- features/rake_task/rake_task.feature
|
165
166
|
- features/reports/codeclimate.feature
|
166
167
|
- features/reports/json.feature
|
167
168
|
- features/reports/reports.feature
|
168
169
|
- features/reports/yaml.feature
|
170
|
+
- features/rspec_matcher.feature
|
169
171
|
- features/samples.feature
|
170
172
|
- features/step_definitions/.rubocop.yml
|
171
173
|
- features/step_definitions/reek_steps.rb
|
@@ -230,6 +232,7 @@ files:
|
|
230
232
|
- lib/reek/errors/bad_detector_configuration_key_in_comment_error.rb
|
231
233
|
- lib/reek/errors/bad_detector_in_comment_error.rb
|
232
234
|
- lib/reek/errors/base_error.rb
|
235
|
+
- lib/reek/errors/encoding_error.rb
|
233
236
|
- lib/reek/errors/garbage_detector_configuration_in_comment_error.rb
|
234
237
|
- lib/reek/errors/incomprehensible_source_error.rb
|
235
238
|
- lib/reek/examiner.rb
|
@@ -443,7 +446,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
443
446
|
version: '0'
|
444
447
|
requirements: []
|
445
448
|
rubyforge_project:
|
446
|
-
rubygems_version: 2.6.
|
449
|
+
rubygems_version: 2.6.13
|
447
450
|
signing_key:
|
448
451
|
specification_version: 4
|
449
452
|
summary: Code smell detector for Ruby
|