reek 6.0.0 → 6.0.3
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/.github/dependabot.yml +9 -0
- data/.github/workflows/ruby.yml +52 -0
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +27 -20
- data/CHANGELOG.md +16 -0
- data/Gemfile +5 -6
- data/README.md +10 -4
- data/docs/Boolean-Parameter.md +2 -2
- data/docs/templates/default/docstring/setup.rb +1 -3
- data/features/command_line_interface/options.feature +2 -2
- data/features/configuration_files/schema_validation.feature +1 -1
- data/features/reports/json.feature +3 -3
- data/features/reports/reports.feature +4 -4
- data/features/reports/yaml.feature +3 -3
- data/features/step_definitions/reek_steps.rb +1 -1
- data/features/step_definitions/sample_file_steps.rb +2 -2
- data/features/support/env.rb +0 -1
- data/lib/reek/ast/node.rb +1 -1
- data/lib/reek/cli/options.rb +1 -1
- data/lib/reek/configuration/app_configuration.rb +4 -3
- data/lib/reek/configuration/configuration_converter.rb +2 -2
- data/lib/reek/configuration/directory_directives.rb +9 -3
- data/lib/reek/configuration/excluded_paths.rb +2 -1
- data/lib/reek/context/code_context.rb +1 -1
- data/lib/reek/context/module_context.rb +3 -1
- data/lib/reek/context/refinement_context.rb +16 -0
- data/lib/reek/context_builder.rb +16 -2
- data/lib/reek/report/code_climate/code_climate_configuration.yml +1 -1
- data/lib/reek/smell_detectors/base_detector.rb +1 -0
- data/lib/reek/smell_detectors/boolean_parameter.rb +3 -1
- data/lib/reek/smell_detectors/uncommunicative_variable_name.rb +1 -1
- data/lib/reek/smell_warning.rb +1 -2
- data/lib/reek/source/source_locator.rb +13 -10
- data/lib/reek/spec/smell_matcher.rb +2 -1
- data/lib/reek/version.rb +1 -1
- data/lib/reek.rb +1 -0
- data/reek.gemspec +10 -2
- data/spec/performance/reek/smell_detectors/runtime_speed_spec.rb +2 -4
- data/spec/quality/documentation_spec.rb +2 -1
- data/spec/reek/code_comment_spec.rb +20 -23
- data/spec/reek/configuration/directory_directives_spec.rb +6 -0
- data/spec/reek/configuration/excluded_paths_spec.rb +12 -3
- data/spec/reek/report/code_climate/code_climate_configuration_spec.rb +1 -3
- data/spec/reek/report/code_climate/code_climate_fingerprint_spec.rb +26 -26
- data/spec/reek/report/code_climate/code_climate_formatter_spec.rb +6 -6
- data/spec/reek/report/location_formatter_spec.rb +3 -3
- data/spec/reek/smell_detectors/base_detector_spec.rb +3 -3
- data/spec/reek/smell_detectors/utility_function_spec.rb +16 -0
- data/spec/reek/smell_warning_spec.rb +12 -12
- data/spec/reek/spec/should_reek_of_spec.rb +0 -1
- data/spec/reek/spec/should_reek_only_of_spec.rb +6 -6
- data/spec/reek/spec/smell_matcher_spec.rb +1 -1
- data/spec/spec_helper.rb +18 -5
- data/tasks/configuration.rake +1 -2
- metadata +21 -27
- data/.travis.yml +0 -36
- data/spec/factories/factories.rb +0 -37
|
@@ -40,7 +40,7 @@ RSpec.describe Reek::Spec::ShouldReekOnlyOf do
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
context 'with 1 non-matching smell' do
|
|
43
|
-
let(:smells) { [
|
|
43
|
+
let(:smells) { [build_smell_warning(smell_type: 'ControlParameter')] }
|
|
44
44
|
|
|
45
45
|
it_behaves_like 'no match'
|
|
46
46
|
end
|
|
@@ -48,8 +48,8 @@ RSpec.describe Reek::Spec::ShouldReekOnlyOf do
|
|
|
48
48
|
context 'with 2 non-matching smells' do
|
|
49
49
|
let(:smells) do
|
|
50
50
|
[
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
build_smell_warning(smell_type: 'ControlParameter'),
|
|
52
|
+
build_smell_warning(smell_type: 'FeatureEnvy')
|
|
53
53
|
]
|
|
54
54
|
end
|
|
55
55
|
|
|
@@ -59,8 +59,8 @@ RSpec.describe Reek::Spec::ShouldReekOnlyOf do
|
|
|
59
59
|
context 'with 1 non-matching and 1 matching smell' do
|
|
60
60
|
let(:smells) do
|
|
61
61
|
[
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
build_smell_warning(smell_type: 'ControlParameter'),
|
|
63
|
+
build_smell_warning(smell_type: expected_smell_type.to_s,
|
|
64
64
|
message: "message mentioning #{expected_context_name}")
|
|
65
65
|
]
|
|
66
66
|
end
|
|
@@ -70,7 +70,7 @@ RSpec.describe Reek::Spec::ShouldReekOnlyOf do
|
|
|
70
70
|
|
|
71
71
|
context 'with 1 matching smell' do
|
|
72
72
|
let(:smells) do
|
|
73
|
-
[
|
|
73
|
+
[build_smell_warning(smell_type: expected_smell_type.to_s,
|
|
74
74
|
message: "message mentioning #{expected_context_name}")]
|
|
75
75
|
end
|
|
76
76
|
|
|
@@ -3,7 +3,7 @@ require_lib 'reek/spec/smell_matcher'
|
|
|
3
3
|
|
|
4
4
|
RSpec.describe Reek::Spec::SmellMatcher do
|
|
5
5
|
let(:smell_warning) do
|
|
6
|
-
|
|
6
|
+
build_smell_warning(smell_type: 'UncommunicativeVariableName',
|
|
7
7
|
message: "has the variable name '@s'",
|
|
8
8
|
parameters: { test: 'something' })
|
|
9
9
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require 'pathname'
|
|
2
2
|
require 'timeout'
|
|
3
|
-
require 'active_support/core_ext/string/strip'
|
|
4
3
|
require 'rspec-benchmark'
|
|
5
4
|
require_relative '../lib/reek'
|
|
6
5
|
require_relative '../lib/reek/spec'
|
|
@@ -14,9 +13,6 @@ begin
|
|
|
14
13
|
rescue LoadError # rubocop:disable Lint/SuppressedException
|
|
15
14
|
end
|
|
16
15
|
|
|
17
|
-
require 'factory_bot'
|
|
18
|
-
FactoryBot.find_definitions
|
|
19
|
-
|
|
20
16
|
# Simple helpers for our specs.
|
|
21
17
|
module Helpers
|
|
22
18
|
def test_configuration_for(config)
|
|
@@ -70,12 +66,29 @@ module Helpers
|
|
|
70
66
|
@klass_map ||= Reek::AST::ASTNodeClassMap.new
|
|
71
67
|
@klass_map.klass_for(type).new(type, children)
|
|
72
68
|
end
|
|
69
|
+
|
|
70
|
+
def build_smell_warning(smell_type: 'FeatureEnvy',
|
|
71
|
+
context: 'self',
|
|
72
|
+
lines: [42],
|
|
73
|
+
message: 'smell warning message',
|
|
74
|
+
source: 'dummy_file',
|
|
75
|
+
parameters: {})
|
|
76
|
+
Reek::SmellWarning.new(smell_type,
|
|
77
|
+
context: context,
|
|
78
|
+
lines: lines,
|
|
79
|
+
message: message,
|
|
80
|
+
source: source,
|
|
81
|
+
parameters: parameters)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def build_code_comment(comment: '', line: 1, source: 'string')
|
|
85
|
+
Reek::CodeComment.new(comment: comment, line: line, source: source)
|
|
86
|
+
end
|
|
73
87
|
end
|
|
74
88
|
|
|
75
89
|
RSpec.configure do |config|
|
|
76
90
|
config.filter_run :focus
|
|
77
91
|
config.run_all_when_everything_filtered = true
|
|
78
|
-
config.include FactoryBot::Syntax::Methods
|
|
79
92
|
config.include Helpers
|
|
80
93
|
config.include RSpec::Benchmark::Matchers
|
|
81
94
|
config.example_status_persistence_file_path = 'spec/examples.txt'
|
data/tasks/configuration.rake
CHANGED
|
@@ -8,11 +8,10 @@ require 'yaml'
|
|
|
8
8
|
namespace :configuration do
|
|
9
9
|
desc 'Updates the default configuration file when smell defaults change'
|
|
10
10
|
task :update_default_configuration do
|
|
11
|
-
DEFAULT_SMELL_CONFIGURATION = 'docs/defaults.reek.yml'.freeze
|
|
12
11
|
content = Reek::DetectorRepository.smell_types.each_with_object({}) do |klass, hash|
|
|
13
12
|
hash[klass.smell_type] = Reek::Configuration::RakeTaskConverter.convert klass.default_config
|
|
14
13
|
end
|
|
15
|
-
File.open(DEFAULT_SMELL_CONFIGURATION, 'w') do |file|
|
|
14
|
+
File.open(Reek::DEFAULT_SMELL_CONFIGURATION, 'w') do |file|
|
|
16
15
|
YAML.dump({ Reek::DETECTORS_KEY => content }, file)
|
|
17
16
|
end
|
|
18
17
|
end
|
metadata
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: reek
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.
|
|
4
|
+
version: 6.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kevin Rutherford
|
|
8
8
|
- Timo Roessner
|
|
9
9
|
- Matijs van Zuijlen
|
|
10
10
|
- Piotr Szotkowski
|
|
11
|
-
autorequire:
|
|
11
|
+
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date:
|
|
14
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: kwalify
|
|
@@ -31,42 +31,30 @@ dependencies:
|
|
|
31
31
|
name: parser
|
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
|
33
33
|
requirements:
|
|
34
|
-
- - "
|
|
35
|
-
- !ruby/object:Gem::Version
|
|
36
|
-
version: '2.8'
|
|
37
|
-
- - ">="
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: 2.5.0.0
|
|
40
|
-
- - "!="
|
|
34
|
+
- - "~>"
|
|
41
35
|
- !ruby/object:Gem::Version
|
|
42
|
-
version:
|
|
36
|
+
version: 3.0.0
|
|
43
37
|
type: :runtime
|
|
44
38
|
prerelease: false
|
|
45
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
46
40
|
requirements:
|
|
47
|
-
- - "
|
|
48
|
-
- !ruby/object:Gem::Version
|
|
49
|
-
version: '2.8'
|
|
50
|
-
- - ">="
|
|
51
|
-
- !ruby/object:Gem::Version
|
|
52
|
-
version: 2.5.0.0
|
|
53
|
-
- - "!="
|
|
41
|
+
- - "~>"
|
|
54
42
|
- !ruby/object:Gem::Version
|
|
55
|
-
version:
|
|
43
|
+
version: 3.0.0
|
|
56
44
|
- !ruby/object:Gem::Dependency
|
|
57
45
|
name: psych
|
|
58
46
|
requirement: !ruby/object:Gem::Requirement
|
|
59
47
|
requirements:
|
|
60
48
|
- - "~>"
|
|
61
49
|
- !ruby/object:Gem::Version
|
|
62
|
-
version: 3.1
|
|
50
|
+
version: '3.1'
|
|
63
51
|
type: :runtime
|
|
64
52
|
prerelease: false
|
|
65
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
54
|
requirements:
|
|
67
55
|
- - "~>"
|
|
68
56
|
- !ruby/object:Gem::Version
|
|
69
|
-
version: 3.1
|
|
57
|
+
version: '3.1'
|
|
70
58
|
- !ruby/object:Gem::Dependency
|
|
71
59
|
name: rainbow
|
|
72
60
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -100,12 +88,13 @@ extra_rdoc_files:
|
|
|
100
88
|
- License.txt
|
|
101
89
|
files:
|
|
102
90
|
- ".dockerignore"
|
|
91
|
+
- ".github/dependabot.yml"
|
|
92
|
+
- ".github/workflows/ruby.yml"
|
|
103
93
|
- ".gitignore"
|
|
104
94
|
- ".reek.yml"
|
|
105
95
|
- ".rubocop.yml"
|
|
106
96
|
- ".rubocop_todo.yml"
|
|
107
97
|
- ".simplecov"
|
|
108
|
-
- ".travis.yml"
|
|
109
98
|
- ".yardopts"
|
|
110
99
|
- CHANGELOG.md
|
|
111
100
|
- CONTRIBUTING.md
|
|
@@ -251,6 +240,7 @@ files:
|
|
|
251
240
|
- lib/reek/context/ghost_context.rb
|
|
252
241
|
- lib/reek/context/method_context.rb
|
|
253
242
|
- lib/reek/context/module_context.rb
|
|
243
|
+
- lib/reek/context/refinement_context.rb
|
|
254
244
|
- lib/reek/context/root_context.rb
|
|
255
245
|
- lib/reek/context/send_context.rb
|
|
256
246
|
- lib/reek/context/singleton_attribute_context.rb
|
|
@@ -372,7 +362,6 @@ files:
|
|
|
372
362
|
- samples/source_with_non_ruby_files/gibberish
|
|
373
363
|
- samples/source_with_non_ruby_files/python_source.py
|
|
374
364
|
- samples/source_with_non_ruby_files/ruby.rb
|
|
375
|
-
- spec/factories/factories.rb
|
|
376
365
|
- spec/performance/reek/smell_detectors/runtime_speed_spec.rb
|
|
377
366
|
- spec/quality/documentation_spec.rb
|
|
378
367
|
- spec/quality/reek_source_spec.rb
|
|
@@ -466,8 +455,13 @@ files:
|
|
|
466
455
|
homepage: https://github.com/troessner/reek
|
|
467
456
|
licenses:
|
|
468
457
|
- MIT
|
|
469
|
-
metadata:
|
|
470
|
-
|
|
458
|
+
metadata:
|
|
459
|
+
homepage_uri: https://github.com/troessner/reek
|
|
460
|
+
source_code_uri: https://github.com/troessner/reek
|
|
461
|
+
bug_tracker_uri: https://github.com/troessner/reek/issues
|
|
462
|
+
changelog_uri: https://github.com/troessner/reek/CHANGELOG.md
|
|
463
|
+
documentation_uri: https://www.rubydoc.info/gems/reek
|
|
464
|
+
post_install_message:
|
|
471
465
|
rdoc_options:
|
|
472
466
|
- "--main"
|
|
473
467
|
- README.md
|
|
@@ -486,9 +480,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
486
480
|
- !ruby/object:Gem::Version
|
|
487
481
|
version: '0'
|
|
488
482
|
requirements: []
|
|
489
|
-
rubyforge_project:
|
|
483
|
+
rubyforge_project:
|
|
490
484
|
rubygems_version: 2.7.7
|
|
491
|
-
signing_key:
|
|
485
|
+
signing_key:
|
|
492
486
|
specification_version: 4
|
|
493
487
|
summary: Code smell detector for Ruby
|
|
494
488
|
test_files: []
|
data/.travis.yml
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
|
|
3
|
-
dist: xenial
|
|
4
|
-
|
|
5
|
-
cache:
|
|
6
|
-
bundler: true
|
|
7
|
-
|
|
8
|
-
bundler_args: --without debugging
|
|
9
|
-
|
|
10
|
-
script: bundle exec rake ci
|
|
11
|
-
|
|
12
|
-
rvm:
|
|
13
|
-
- 2.4
|
|
14
|
-
- 2.5
|
|
15
|
-
- 2.6
|
|
16
|
-
- 2.7
|
|
17
|
-
- jruby-9.2
|
|
18
|
-
- jruby-head
|
|
19
|
-
- ruby-head
|
|
20
|
-
|
|
21
|
-
matrix:
|
|
22
|
-
allow_failures:
|
|
23
|
-
- rvm: jruby-head
|
|
24
|
-
- rvm: ruby-head
|
|
25
|
-
fast_finish: true
|
|
26
|
-
|
|
27
|
-
notifications:
|
|
28
|
-
email:
|
|
29
|
-
- timo.roessner@googlemail.com
|
|
30
|
-
- matijs@matijs.net
|
|
31
|
-
- chastell@chastell.net
|
|
32
|
-
irc: irc.freenode.org#reek
|
|
33
|
-
|
|
34
|
-
branches:
|
|
35
|
-
only:
|
|
36
|
-
- master
|
data/spec/factories/factories.rb
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require_relative '../../lib/reek/smell_detectors'
|
|
2
|
-
require_relative '../../lib/reek/smell_detectors/base_detector'
|
|
3
|
-
require_relative '../../lib/reek/smell_warning'
|
|
4
|
-
require_relative '../../lib/reek/cli/options'
|
|
5
|
-
|
|
6
|
-
FactoryBot.define do
|
|
7
|
-
factory :smell_warning, class: 'Reek::SmellWarning' do
|
|
8
|
-
skip_create
|
|
9
|
-
|
|
10
|
-
smell_type { 'FeatureEnvy' }
|
|
11
|
-
source { 'dummy_file' }
|
|
12
|
-
lines { [42] }
|
|
13
|
-
message { 'smell warning message' }
|
|
14
|
-
parameters { {} }
|
|
15
|
-
context { 'self' }
|
|
16
|
-
|
|
17
|
-
initialize_with do
|
|
18
|
-
new(smell_type,
|
|
19
|
-
source: source,
|
|
20
|
-
context: context,
|
|
21
|
-
lines: lines,
|
|
22
|
-
message: message,
|
|
23
|
-
parameters: parameters)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
factory :code_comment, class: 'Reek::CodeComment' do
|
|
28
|
-
comment { '' }
|
|
29
|
-
line { 1 }
|
|
30
|
-
source { 'string' }
|
|
31
|
-
initialize_with do
|
|
32
|
-
new comment: comment,
|
|
33
|
-
line: line,
|
|
34
|
-
source: source
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|