reek 6.0.6 → 6.1.4
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 +4 -0
- data/.github/workflows/ruby.yml +34 -29
- data/.rubocop.yml +6 -4
- data/CHANGELOG.md +22 -0
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +6 -6
- data/README.md +2 -2
- data/lib/reek/ast/sexp_extensions/arguments.rb +20 -0
- data/lib/reek/ast/sexp_extensions/case.rb +1 -1
- data/lib/reek/ast/sexp_extensions/if.rb +1 -1
- data/lib/reek/ast/sexp_extensions/send.rb +1 -1
- data/lib/reek/cli/command/todo_list_command.rb +2 -2
- data/lib/reek/cli/options.rb +6 -6
- data/lib/reek/configuration/configuration_file_finder.rb +2 -1
- data/lib/reek/context/module_context.rb +4 -0
- data/lib/reek/context/send_context.rb +6 -0
- data/lib/reek/context_builder.rb +1 -1
- data/lib/reek/rake/task.rb +5 -5
- data/lib/reek/report/code_climate/code_climate_configuration.yml +3 -3
- data/lib/reek/smell_detectors/class_variable.rb +2 -2
- data/lib/reek/smell_detectors/control_parameter_helpers/candidate.rb +6 -6
- data/lib/reek/smell_detectors/duplicate_method_call.rb +5 -5
- data/lib/reek/smell_detectors/unused_private_method.rb +1 -0
- data/lib/reek/smell_warning.rb +1 -1
- data/lib/reek/spec/should_reek_of.rb +11 -9
- data/lib/reek/spec.rb +1 -1
- data/lib/reek/version.rb +1 -1
- data/reek.gemspec +25 -24
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75ed5064f626b7d8ae34f869ee17d53960804381fb73db707c866202bb71490a
|
|
4
|
+
data.tar.gz: 07f819f93d3ac3f84deb0a0a113dfbc3136e70f9b097f72e1c535f4352fb8b7f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 71313200963b12c5c2edb8cd84d5ee4ea8fd99241c1fa0f6c6329e332ba41538b5a11990b54f24a136a748bc2492fd87f5ffcd78ef358bdd4f1420970bd2915b
|
|
7
|
+
data.tar.gz: 2f39a6f2ea9cf9a4d8eb629bc5542883ecccfb8811c1fc062a2c0aa8deb41ceacd47de2a76a2f9cb8f6b0e6b56da63551f403edc14e55cd35ae7bac62822a2b3
|
data/.github/dependabot.yml
CHANGED
data/.github/workflows/ruby.yml
CHANGED
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
# run tests with Rake
|
|
3
3
|
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
4
4
|
|
|
5
|
-
name:
|
|
5
|
+
name: CI
|
|
6
6
|
|
|
7
|
-
on:
|
|
7
|
+
"on":
|
|
8
8
|
push:
|
|
9
|
-
branches: [
|
|
9
|
+
branches: [master]
|
|
10
10
|
pull_request:
|
|
11
|
-
branches: [
|
|
11
|
+
branches: [master]
|
|
12
|
+
schedule:
|
|
13
|
+
- cron: '16 4 12 * *'
|
|
12
14
|
|
|
15
|
+
env:
|
|
16
|
+
CUCUMBER_PUBLISH_QUIET: true
|
|
17
|
+
RUBYOPTS: "--disable-did-you-mean"
|
|
13
18
|
jobs:
|
|
14
19
|
test:
|
|
15
20
|
|
|
@@ -17,36 +22,36 @@ jobs:
|
|
|
17
22
|
|
|
18
23
|
strategy:
|
|
19
24
|
matrix:
|
|
20
|
-
ruby: [2.
|
|
25
|
+
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2", "jruby-9.3", "jruby-9.4"]
|
|
21
26
|
|
|
22
27
|
steps:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
- uses: actions/checkout@v3
|
|
29
|
+
- name: Set up Ruby
|
|
30
|
+
uses: ruby/setup-ruby@v1
|
|
31
|
+
with:
|
|
32
|
+
ruby-version: ${{ matrix.ruby }}
|
|
33
|
+
bundler-cache: true
|
|
34
|
+
- name: Run specs
|
|
35
|
+
run: bundle exec rake test:spec
|
|
36
|
+
- name: Run performance tests
|
|
37
|
+
run: bundle exec rake test:performance
|
|
38
|
+
- name: Update default configuration
|
|
39
|
+
run: bundle exec rake configuration:update_default_configuration
|
|
40
|
+
- name: Run cucumber features
|
|
41
|
+
run: bundle exec rake test:features
|
|
42
|
+
- name: Run code quality specs
|
|
43
|
+
run: bundle exec rake test:quality
|
|
39
44
|
|
|
40
45
|
rubocop:
|
|
41
46
|
|
|
42
47
|
runs-on: ubuntu-latest
|
|
43
48
|
|
|
44
49
|
steps:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
- uses: actions/checkout@v3
|
|
51
|
+
- name: Set up Ruby
|
|
52
|
+
uses: ruby/setup-ruby@v1
|
|
53
|
+
with:
|
|
54
|
+
ruby-version: 2.7
|
|
55
|
+
bundler-cache: true
|
|
56
|
+
- name: Run RuboCop
|
|
57
|
+
run: bundle exec rubocop -P
|
data/.rubocop.yml
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
|
2
2
|
|
|
3
|
+
inherit_mode:
|
|
4
|
+
merge:
|
|
5
|
+
- Exclude
|
|
6
|
+
|
|
3
7
|
require:
|
|
4
8
|
- rubocop-rspec
|
|
5
9
|
- rubocop-performance
|
|
@@ -7,10 +11,8 @@ require:
|
|
|
7
11
|
AllCops:
|
|
8
12
|
Exclude:
|
|
9
13
|
- 'samples/**/*'
|
|
10
|
-
- 'tmp/**/*'
|
|
11
|
-
- 'vendor/**/*'
|
|
12
14
|
NewCops: enable
|
|
13
|
-
TargetRubyVersion: 2.
|
|
15
|
+
TargetRubyVersion: 2.6
|
|
14
16
|
|
|
15
17
|
# Tables are nice
|
|
16
18
|
Layout/HashAlignment:
|
|
@@ -46,7 +48,7 @@ Layout/MultilineOperationIndentation:
|
|
|
46
48
|
Lint/AmbiguousBlockAssociation:
|
|
47
49
|
Enabled: false
|
|
48
50
|
|
|
49
|
-
# Some of our source examples include interpolation
|
|
51
|
+
# Some of our source examples include interpolation explicitly.
|
|
50
52
|
Lint/InterpolationCheck:
|
|
51
53
|
Exclude:
|
|
52
54
|
- 'spec/**/*'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
## 6.1.4 (2023-01-13)
|
|
4
|
+
|
|
5
|
+
* (mvz) Update parser dependency to the 3.2.x series
|
|
6
|
+
|
|
7
|
+
## 6.1.3 (2022-12-29)
|
|
8
|
+
|
|
9
|
+
* (gonubana) Allow failing safely when trying to recursively find a configuration
|
|
10
|
+
|
|
11
|
+
## 6.1.2 (2022-11-21)
|
|
12
|
+
|
|
13
|
+
* (mvz) Add support for keyword nil arguments
|
|
14
|
+
|
|
15
|
+
## 6.1.1 (2022-04-20)
|
|
16
|
+
|
|
17
|
+
* (ydah) UnusedPrivateMethod to be detect use of methods via `Method#to_proc`
|
|
18
|
+
|
|
19
|
+
## 6.1.0 (2022-01-14)
|
|
20
|
+
|
|
21
|
+
* (mvz) Drop support for Ruby 2.4 and 2.5
|
|
22
|
+
* (mvz) Support Ruby 3.0 and 3.1
|
|
23
|
+
* (mvz) Support argument forwarding after regular arguments
|
|
24
|
+
|
|
3
25
|
## 6.0.6 (2021-08-12)
|
|
4
26
|
|
|
5
27
|
* (mvz) Remove explicit dependency on psych. This fixes an issue where
|
data/CONTRIBUTING.md
CHANGED
|
@@ -142,7 +142,7 @@ Once you’re happy with your feature / fix – or want to
|
|
|
142
142
|
share it as a work-in-progress and request comments – once
|
|
143
143
|
again make sure all of the tests pass. This will also run
|
|
144
144
|
[RuboCop](https://github.com/bbatsov/rubocop) – fix any
|
|
145
|
-
|
|
145
|
+
offenses RuboCop finds (or discuss them in the pull request):
|
|
146
146
|
|
|
147
147
|
```
|
|
148
148
|
bundle exec rake
|
data/Gemfile
CHANGED
|
@@ -5,18 +5,18 @@ gemspec
|
|
|
5
5
|
ruby RUBY_VERSION
|
|
6
6
|
|
|
7
7
|
group :development do
|
|
8
|
-
gem 'aruba', '~> 1
|
|
8
|
+
gem 'aruba', '~> 2.1'
|
|
9
9
|
gem 'codeclimate-engine-rb', '~> 0.4.0'
|
|
10
|
-
gem 'cucumber',
|
|
10
|
+
gem 'cucumber', '~> 8.0'
|
|
11
11
|
gem 'kramdown', '~> 2.1'
|
|
12
12
|
gem 'kramdown-parser-gfm', '~> 1.0'
|
|
13
13
|
gem 'rake', '~> 13.0'
|
|
14
14
|
gem 'rspec', '~> 3.0'
|
|
15
15
|
gem 'rspec-benchmark', '~> 0.6.0'
|
|
16
|
-
gem 'rubocop', '~> 1.
|
|
17
|
-
gem 'rubocop-performance', '~> 1.
|
|
18
|
-
gem 'rubocop-rspec', '~> 2.
|
|
19
|
-
gem 'simplecov',
|
|
16
|
+
gem 'rubocop', '~> 1.43.0'
|
|
17
|
+
gem 'rubocop-performance', '~> 1.15.0'
|
|
18
|
+
gem 'rubocop-rspec', '~> 2.17.0'
|
|
19
|
+
gem 'simplecov', '>= 0.18.0', '< 0.23.0'
|
|
20
20
|
gem 'yard', '~> 0.9.5'
|
|
21
21
|
|
|
22
22
|
platforms :mri do
|
data/README.md
CHANGED
|
@@ -94,7 +94,7 @@ demo.rb -- 2 warnings:
|
|
|
94
94
|
|
|
95
95
|
## Supported Ruby versions
|
|
96
96
|
|
|
97
|
-
Reek is officially supported for CRuby 2.
|
|
97
|
+
Reek is officially supported for CRuby 2.6 through 3.1 and for JRuby 9.3.
|
|
98
98
|
Other Ruby implementations (like Rubinius) are not officially supported but
|
|
99
99
|
should work as well.
|
|
100
100
|
|
|
@@ -411,7 +411,7 @@ def smelly_method foo
|
|
|
411
411
|
end
|
|
412
412
|
```
|
|
413
413
|
|
|
414
|
-
This is an incredibly powerful feature and further explained under [Smell
|
|
414
|
+
This is an incredibly powerful feature and further explained under [Smell Suppression](docs/Smell-Suppression.md).
|
|
415
415
|
|
|
416
416
|
#### Debugging trouble with the configuration
|
|
417
417
|
|
|
@@ -104,6 +104,26 @@ module Reek
|
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
106
|
# rubocop:enable Naming/ClassAndModuleCamelCase
|
|
107
|
+
|
|
108
|
+
# Utility methods for :forward_arg nodes.
|
|
109
|
+
# rubocop:disable Naming/ClassAndModuleCamelCase
|
|
110
|
+
module Forward_ArgNode
|
|
111
|
+
include ArgNodeBase
|
|
112
|
+
|
|
113
|
+
def anonymous_splat?
|
|
114
|
+
true
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
# rubocop:enable Naming/ClassAndModuleCamelCase
|
|
118
|
+
|
|
119
|
+
# Utility methods for :kwnilarg nodes.
|
|
120
|
+
module KwnilargNode
|
|
121
|
+
include ArgNodeBase
|
|
122
|
+
|
|
123
|
+
def anonymous_splat?
|
|
124
|
+
true
|
|
125
|
+
end
|
|
126
|
+
end
|
|
107
127
|
end
|
|
108
128
|
end
|
|
109
129
|
end
|
|
@@ -23,8 +23,8 @@ module Reek
|
|
|
23
23
|
puts EXISTING_FILE_MESSAGE
|
|
24
24
|
else
|
|
25
25
|
write_to_file
|
|
26
|
-
puts "\n'#{DEFAULT_CONFIGURATION_FILE_NAME}' generated! "\
|
|
27
|
-
|
|
26
|
+
puts "\n'#{DEFAULT_CONFIGURATION_FILE_NAME}' generated! " \
|
|
27
|
+
'You can now use this as a starting point.'
|
|
28
28
|
end
|
|
29
29
|
options.success_exit_code
|
|
30
30
|
end
|
data/lib/reek/cli/options.rb
CHANGED
|
@@ -110,12 +110,12 @@ module Reek
|
|
|
110
110
|
parser.on('--smell SMELL',
|
|
111
111
|
'Only look for a specific smell.',
|
|
112
112
|
'Call it like this: reek --smell MissingSafeMethod source.rb',
|
|
113
|
-
"Check out #{DocumentationLink.build('Code Smells')} "\
|
|
113
|
+
"Check out #{DocumentationLink.build('Code Smells')} " \
|
|
114
114
|
'for a list of smells') do |smell|
|
|
115
115
|
smells_to_detect << smell
|
|
116
116
|
end
|
|
117
117
|
parser.on('--stdin-filename FILE',
|
|
118
|
-
'When passing code in via pipe, assume this filename when '\
|
|
118
|
+
'When passing code in via pipe, assume this filename when ' \
|
|
119
119
|
'checking file or directory rules in the config.') do |file|
|
|
120
120
|
self.stdin_filename = file
|
|
121
121
|
end
|
|
@@ -210,12 +210,12 @@ module Reek
|
|
|
210
210
|
def set_exit_codes
|
|
211
211
|
parser.separator "\nExit codes:"
|
|
212
212
|
parser.on('--success-exit-code CODE',
|
|
213
|
-
'The exit code when no smells are found '\
|
|
213
|
+
'The exit code when no smells are found ' \
|
|
214
214
|
"(default: #{Status::DEFAULT_SUCCESS_EXIT_CODE})") do |option|
|
|
215
215
|
self.success_exit_code = Integer(option)
|
|
216
216
|
end
|
|
217
217
|
parser.on('--failure-exit-code CODE',
|
|
218
|
-
'The exit code when smells are found '\
|
|
218
|
+
'The exit code when smells are found ' \
|
|
219
219
|
"(default: #{Status::DEFAULT_FAILURE_EXIT_CODE})") do |option|
|
|
220
220
|
self.failure_exit_code = Integer(option)
|
|
221
221
|
end
|
|
@@ -231,8 +231,8 @@ module Reek
|
|
|
231
231
|
parser.on_tail('-l', '--list', 'List all available smell detectors') do
|
|
232
232
|
puts "All available smell detectors:\n\n"
|
|
233
233
|
puts DetectorRepository.available_detector_names
|
|
234
|
-
puts "\nCheck out #{DocumentationLink.build('Code Smells')} "\
|
|
235
|
-
|
|
234
|
+
puts "\nCheck out #{DocumentationLink.build('Code Smells')} " \
|
|
235
|
+
'for a details on each detector'
|
|
236
236
|
exit
|
|
237
237
|
end
|
|
238
238
|
parser.on_tail('-v', '--version', 'Show version') do
|
data/lib/reek/context_builder.rb
CHANGED
|
@@ -422,7 +422,7 @@ module Reek
|
|
|
422
422
|
# See `process_rescue` for additional reference.
|
|
423
423
|
#
|
|
424
424
|
def process_resbody(exp, _parent)
|
|
425
|
-
increase_statement_count_by(exp.children[1
|
|
425
|
+
increase_statement_count_by(exp.children[1..].compact)
|
|
426
426
|
process(exp)
|
|
427
427
|
end
|
|
428
428
|
|
data/lib/reek/rake/task.rb
CHANGED
|
@@ -69,15 +69,15 @@ module Reek
|
|
|
69
69
|
|
|
70
70
|
# @public
|
|
71
71
|
def initialize(name = :reek)
|
|
72
|
-
@config_file = ENV
|
|
72
|
+
@config_file = ENV.fetch('REEK_CFG', nil)
|
|
73
73
|
@name = name
|
|
74
|
-
@reek_opts = ENV
|
|
74
|
+
@reek_opts = ENV.fetch('REEK_OPTS', '')
|
|
75
75
|
@fail_on_error = true
|
|
76
76
|
@verbose = false
|
|
77
77
|
|
|
78
78
|
yield self if block_given?
|
|
79
79
|
|
|
80
|
-
if (reek_src = ENV
|
|
80
|
+
if (reek_src = ENV.fetch('REEK_SRC', nil))
|
|
81
81
|
@source_files = FileList[reek_src]
|
|
82
82
|
end
|
|
83
83
|
@source_files ||= FileList['lib/**/*.rb']
|
|
@@ -87,8 +87,8 @@ module Reek
|
|
|
87
87
|
# @public
|
|
88
88
|
def source_files=(files)
|
|
89
89
|
unless files.is_a?(String) || files.is_a?(FileList)
|
|
90
|
-
raise ArgumentError, 'File list should be a FileList or a String that can contain'\
|
|
91
|
-
|
|
90
|
+
raise ArgumentError, 'File list should be a FileList or a String that can contain ' \
|
|
91
|
+
"a glob pattern, e.g. '{app,lib,spec}/**/*.rb'"
|
|
92
92
|
end
|
|
93
93
|
@source_files = FileList[files]
|
|
94
94
|
end
|
|
@@ -63,7 +63,7 @@ BooleanParameter:
|
|
|
63
63
|
|
|
64
64
|
* Move everything in the `if` branch into a separate method
|
|
65
65
|
* Move everything in the `else` branch into a separate method
|
|
66
|
-
* Get rid of the `hit_the_switch` method
|
|
66
|
+
* Get rid of the `hit_the_switch` method altogether
|
|
67
67
|
* Make the decision what method to call in the initial caller of `hit_the_switch`
|
|
68
68
|
ClassVariable:
|
|
69
69
|
remediation_points: 350_000
|
|
@@ -119,7 +119,7 @@ ControlParameter:
|
|
|
119
119
|
end
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
Fixing those problems is out of the scope of this document but an easy solution could be to remove the "write" method
|
|
122
|
+
Fixing those problems is out of the scope of this document but an easy solution could be to remove the "write" method altogether and to move the calls to "write_quoted" / "write_unquoted" in the initial caller of "write".
|
|
123
123
|
DataClump:
|
|
124
124
|
remediation_points: 250_000
|
|
125
125
|
content: |
|
|
@@ -768,7 +768,7 @@ TooManyStatements:
|
|
|
768
768
|
end
|
|
769
769
|
```
|
|
770
770
|
|
|
771
|
-
(You might argue that the two
|
|
771
|
+
(You might argue that the two assignments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)
|
|
772
772
|
UncommunicativeMethodName:
|
|
773
773
|
remediation_points: 150_000
|
|
774
774
|
content: |
|
|
@@ -25,8 +25,8 @@ module Reek
|
|
|
25
25
|
# @return [Array<SmellWarning>]
|
|
26
26
|
#
|
|
27
27
|
def sniff
|
|
28
|
-
class_variables_in_context.map do |variable,
|
|
29
|
-
lines =
|
|
28
|
+
class_variables_in_context.map do |variable, occurrences|
|
|
29
|
+
lines = occurrences.map(&:line)
|
|
30
30
|
smell_warning(
|
|
31
31
|
lines: lines,
|
|
32
32
|
message: "declares the class variable '#{variable}'",
|
|
@@ -9,20 +9,20 @@ module Reek
|
|
|
9
9
|
class Candidate
|
|
10
10
|
#
|
|
11
11
|
# @param parameter [Symbol] the parameter name
|
|
12
|
-
# @param
|
|
12
|
+
# @param occurrences [Array<Reek::AST::Node>] the occurrences of the ControlParameter smell
|
|
13
13
|
# e.g. [s(:lvar, :bravo), s(:lvar, :bravo)]
|
|
14
14
|
#
|
|
15
|
-
def initialize(parameter,
|
|
15
|
+
def initialize(parameter, occurrences)
|
|
16
16
|
@parameter = parameter
|
|
17
|
-
@
|
|
17
|
+
@occurrences = occurrences
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def smells?
|
|
21
|
-
|
|
21
|
+
occurrences.any?
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def lines
|
|
25
|
-
|
|
25
|
+
occurrences.map(&:line)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def name
|
|
@@ -31,7 +31,7 @@ module Reek
|
|
|
31
31
|
|
|
32
32
|
private
|
|
33
33
|
|
|
34
|
-
attr_reader :
|
|
34
|
+
attr_reader :occurrences, :parameter
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
end
|
|
@@ -67,11 +67,11 @@ module Reek
|
|
|
67
67
|
class FoundCall
|
|
68
68
|
def initialize(call_node)
|
|
69
69
|
@call_node = call_node
|
|
70
|
-
@
|
|
70
|
+
@occurrences = []
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def record(occurence)
|
|
74
|
-
|
|
74
|
+
occurrences.push occurence
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def call
|
|
@@ -79,16 +79,16 @@ module Reek
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
def occurs
|
|
82
|
-
|
|
82
|
+
occurrences.length
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def lines
|
|
86
|
-
|
|
86
|
+
occurrences.map(&:line)
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
private
|
|
90
90
|
|
|
91
|
-
attr_reader :call_node, :
|
|
91
|
+
attr_reader :call_node, :occurrences
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
private_constant :FoundCall
|
|
@@ -61,6 +61,7 @@ module Reek
|
|
|
61
61
|
def unused_private_methods
|
|
62
62
|
defined_private_methods = context.defined_instance_methods(visibility: :private)
|
|
63
63
|
called_method_names = context.instance_method_calls.map(&:name)
|
|
64
|
+
called_method_names.concat(context.instance_method_names_via_to_call)
|
|
64
65
|
|
|
65
66
|
defined_private_methods.reject do |defined_method|
|
|
66
67
|
called_method_names.include?(defined_method.name)
|
data/lib/reek/smell_warning.rb
CHANGED
|
@@ -69,19 +69,21 @@ module Reek
|
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
def set_failure_messages_for_smell_type
|
|
72
|
-
self.failure_message = "Expected #{origin} to reek of #{smell_type}, "\
|
|
73
|
-
|
|
74
|
-
self.failure_message_when_negated = "Expected #{origin} not to reek "\
|
|
75
|
-
|
|
72
|
+
self.failure_message = "Expected #{origin} to reek of #{smell_type}, " \
|
|
73
|
+
'but it didn\'t'
|
|
74
|
+
self.failure_message_when_negated = "Expected #{origin} not to reek " \
|
|
75
|
+
"of #{smell_type}, but it did"
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def set_failure_messages_for_smell_details
|
|
79
|
-
self.failure_message =
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
79
|
+
self.failure_message =
|
|
80
|
+
"Expected #{origin} to reek of #{smell_type} " \
|
|
81
|
+
"(which it did) with smell details #{smell_details}, which it didn't.\n" \
|
|
82
|
+
"The number of smell details I had to compare with the given one was #{matching_smell_types.count} " \
|
|
83
|
+
"and here they are:\n" \
|
|
83
84
|
"#{all_relevant_smell_details_formatted}"
|
|
84
|
-
self.failure_message_when_negated =
|
|
85
|
+
self.failure_message_when_negated =
|
|
86
|
+
"Expected #{origin} not to reek of " \
|
|
85
87
|
"#{smell_type} with smell details #{smell_details}, but it did"
|
|
86
88
|
end
|
|
87
89
|
|
data/lib/reek/spec.rb
CHANGED
data/lib/reek/version.rb
CHANGED
data/reek.gemspec
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
require_relative 'lib/reek/version'
|
|
2
2
|
|
|
3
|
-
Gem::Specification.new do |
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = 'reek'
|
|
5
|
+
spec.version = Reek::Version::STRING
|
|
6
|
+
spec.authors = ['Kevin Rutherford', 'Timo Roessner', 'Matijs van Zuijlen', 'Piotr Szotkowski']
|
|
7
|
+
spec.email = ['timo.roessner@googlemail.com']
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
spec.summary = 'Code smell detector for Ruby'
|
|
10
|
+
spec.description =
|
|
9
11
|
'Reek is a tool that examines Ruby classes, modules and methods and reports ' \
|
|
10
12
|
'any code smells it finds.'
|
|
13
|
+
spec.homepage = 'https://github.com/troessner/reek'
|
|
14
|
+
spec.license = 'MIT'
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
s.extra_rdoc_files = ['CHANGELOG.md', 'License.txt']
|
|
15
|
-
s.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
16
|
+
spec.extra_rdoc_files = ['CHANGELOG.md', 'License.txt']
|
|
17
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
16
18
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|samples|docs|tasks)/}) }
|
|
17
19
|
end
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
s.required_ruby_version = '>= 2.4.0'
|
|
23
|
-
s.summary = 'Code smell detector for Ruby'
|
|
21
|
+
spec.executables = spec.files.grep(%r{^bin/}).map { |path| File.basename(path) }
|
|
22
|
+
spec.rdoc_options = %w(--main README.md -x assets/|bin/|config/|features/|spec/|tasks/)
|
|
23
|
+
spec.required_ruby_version = '>= 2.6.0'
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
'homepage_uri'
|
|
27
|
-
'source_code_uri'
|
|
28
|
-
'bug_tracker_uri'
|
|
29
|
-
'changelog_uri'
|
|
30
|
-
'documentation_uri'
|
|
25
|
+
spec.metadata = {
|
|
26
|
+
'homepage_uri' => 'https://github.com/troessner/reek',
|
|
27
|
+
'source_code_uri' => 'https://github.com/troessner/reek',
|
|
28
|
+
'bug_tracker_uri' => 'https://github.com/troessner/reek/issues',
|
|
29
|
+
'changelog_uri' => 'https://github.com/troessner/reek/CHANGELOG.md',
|
|
30
|
+
'documentation_uri' => 'https://www.rubydoc.info/gems/reek',
|
|
31
|
+
'rubygems_mfa_required' => 'true'
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
spec.add_runtime_dependency 'kwalify', '~> 0.7.0'
|
|
35
|
+
spec.add_runtime_dependency 'parser', '~> 3.2.0'
|
|
36
|
+
spec.add_runtime_dependency 'rainbow', '>= 2.0', '< 4.0'
|
|
36
37
|
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: 6.
|
|
4
|
+
version: 6.1.4
|
|
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: 2023-01-14 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: kwalify
|
|
@@ -33,14 +33,14 @@ dependencies:
|
|
|
33
33
|
requirements:
|
|
34
34
|
- - "~>"
|
|
35
35
|
- !ruby/object:Gem::Version
|
|
36
|
-
version: 3.
|
|
36
|
+
version: 3.2.0
|
|
37
37
|
type: :runtime
|
|
38
38
|
prerelease: false
|
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
40
40
|
requirements:
|
|
41
41
|
- - "~>"
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: 3.
|
|
43
|
+
version: 3.2.0
|
|
44
44
|
- !ruby/object:Gem::Dependency
|
|
45
45
|
name: rainbow
|
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -243,6 +243,7 @@ metadata:
|
|
|
243
243
|
bug_tracker_uri: https://github.com/troessner/reek/issues
|
|
244
244
|
changelog_uri: https://github.com/troessner/reek/CHANGELOG.md
|
|
245
245
|
documentation_uri: https://www.rubydoc.info/gems/reek
|
|
246
|
+
rubygems_mfa_required: 'true'
|
|
246
247
|
post_install_message:
|
|
247
248
|
rdoc_options:
|
|
248
249
|
- "--main"
|
|
@@ -255,14 +256,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
255
256
|
requirements:
|
|
256
257
|
- - ">="
|
|
257
258
|
- !ruby/object:Gem::Version
|
|
258
|
-
version: 2.
|
|
259
|
+
version: 2.6.0
|
|
259
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
261
|
requirements:
|
|
261
262
|
- - ">="
|
|
262
263
|
- !ruby/object:Gem::Version
|
|
263
264
|
version: '0'
|
|
264
265
|
requirements: []
|
|
265
|
-
rubygems_version: 3.
|
|
266
|
+
rubygems_version: 3.4.1
|
|
266
267
|
signing_key:
|
|
267
268
|
specification_version: 4
|
|
268
269
|
summary: Code smell detector for Ruby
|