reek 6.5.0 → 6.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/.github/dependabot.yml +1 -1
- data/.github/workflows/ruby.yml +3 -3
- data/.rubocop.yml +5 -1
- data/.simplecov +6 -11
- data/CHANGELOG.md +35 -1
- data/Gemfile +7 -9
- data/README.md +0 -1
- data/bin/code_climate_reek +88 -86
- data/lib/reek/ast/node.rb +1 -1
- data/lib/reek/ast/sexp_extensions/arguments.rb +2 -4
- data/lib/reek/configuration/configuration_converter.rb +1 -0
- data/lib/reek/configuration/configuration_file_finder.rb +1 -0
- data/lib/reek/configuration/schema.rb +1 -2
- data/lib/reek/context/code_context.rb +1 -0
- data/lib/reek/context_builder.rb +2 -2
- data/lib/reek/rake/task.rb +7 -2
- data/lib/reek/report/text_report.rb +1 -1
- data/lib/reek/smell_detectors/base_detector.rb +0 -1
- data/lib/reek/smell_detectors/class_variable.rb +0 -1
- data/lib/reek/smell_detectors/control_parameter_helpers/call_in_condition_finder.rb +1 -1
- data/lib/reek/smell_detectors/nested_iterators.rb +1 -1
- data/lib/reek/smell_detectors/nil_check.rb +2 -2
- data/lib/reek/smell_detectors/too_many_constants.rb +1 -1
- data/lib/reek/spec/should_reek_of.rb +1 -1
- data/lib/reek/version.rb +1 -1
- data/reek.gemspec +2 -2
- metadata +8 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e94e22df074849d0fa284a5c29a41a39108cb3f1f1cbda8d1c080d44eb6ea468
|
|
4
|
+
data.tar.gz: 8fbfba50a40c1adf1f7bb7522321fd0b04cc1a8db30fd86bddf1f0c2521d6ee4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 90e0a6dd0eb18a7faf3fe991768ee21372491fa387ac7ee9ad33f62747fe1223aec840df6a4d7897452934b2fa13389bf9fa8d6dfb32b71c7bf9a1c427f3931f
|
|
7
|
+
data.tar.gz: 3ab5e3b35c17b57c4090d04c4d24db6fe4ecd6ec31a9137c4363a7cb6df9abd2867c4e7d27955c0e8105d03f517a43bfc69939bb15eebcb5127a6d8786feabbe
|
data/.github/dependabot.yml
CHANGED
data/.github/workflows/ruby.yml
CHANGED
|
@@ -23,10 +23,10 @@ jobs:
|
|
|
23
23
|
|
|
24
24
|
strategy:
|
|
25
25
|
matrix:
|
|
26
|
-
ruby: ["3.
|
|
26
|
+
ruby: ["3.2", "3.3", "3.4", "4.0"]
|
|
27
27
|
|
|
28
28
|
steps:
|
|
29
|
-
- uses: actions/checkout@
|
|
29
|
+
- uses: actions/checkout@v7
|
|
30
30
|
- name: Set up Ruby
|
|
31
31
|
uses: ruby/setup-ruby@v1
|
|
32
32
|
with:
|
|
@@ -48,7 +48,7 @@ jobs:
|
|
|
48
48
|
runs-on: ubuntu-latest
|
|
49
49
|
|
|
50
50
|
steps:
|
|
51
|
-
- uses: actions/checkout@
|
|
51
|
+
- uses: actions/checkout@v7
|
|
52
52
|
- name: Set up Ruby
|
|
53
53
|
uses: ruby/setup-ruby@v1
|
|
54
54
|
with:
|
data/.rubocop.yml
CHANGED
|
@@ -12,7 +12,7 @@ AllCops:
|
|
|
12
12
|
Exclude:
|
|
13
13
|
- 'samples/**/*'
|
|
14
14
|
NewCops: enable
|
|
15
|
-
TargetRubyVersion: 3.
|
|
15
|
+
TargetRubyVersion: 3.2
|
|
16
16
|
|
|
17
17
|
# Tables are nice
|
|
18
18
|
Layout/HashAlignment:
|
|
@@ -67,6 +67,10 @@ Metrics/BlockLength:
|
|
|
67
67
|
Metrics/ParameterLists:
|
|
68
68
|
CountKeywordArgs: false
|
|
69
69
|
|
|
70
|
+
# This cop does not detect predicate methods very well
|
|
71
|
+
Naming/PredicateMethod:
|
|
72
|
+
Enabled: false
|
|
73
|
+
|
|
70
74
|
Naming/RescuedExceptionsVariableName:
|
|
71
75
|
PreferredName: error
|
|
72
76
|
|
data/.simplecov
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
SimpleCov.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
add_filter 'spec/'
|
|
8
|
-
add_filter 'samples/'
|
|
3
|
+
SimpleCov.configure do
|
|
4
|
+
cover 'lib/**/*.rb'
|
|
5
|
+
skip 'lib/reek/version.rb' # version.rb is loaded too early to test
|
|
6
|
+
skip 'lib/reek/cli/options.rb' # tested mostly via integration tests
|
|
9
7
|
coverage_dir 'tmp/coverage'
|
|
10
8
|
enable_coverage :branch
|
|
11
|
-
end
|
|
12
9
|
|
|
13
|
-
SimpleCov.at_exit do
|
|
14
|
-
SimpleCov.result.format!
|
|
15
10
|
unless RUBY_ENGINE == 'jruby'
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
minimum_coverage 98.88
|
|
12
|
+
coverage(:line) { minimum_per_file 81.4 }
|
|
18
13
|
end
|
|
19
14
|
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
|
-
|
|
2
1
|
# Change log
|
|
3
2
|
|
|
3
|
+
## 6.6.0 (2026-10-02)
|
|
4
|
+
|
|
5
|
+
### Bugfixes
|
|
6
|
+
|
|
7
|
+
* Fix handling of env vars overriding reek task definitions ([#1826] by [mvz])
|
|
8
|
+
|
|
9
|
+
### Documentation
|
|
10
|
+
|
|
11
|
+
* Fix `Control Couple` documentation link ([#1823] by [dancristianb])
|
|
12
|
+
* [documentation] Remove reference to codebeat.co ([#1828] by [etagwerker])
|
|
13
|
+
|
|
14
|
+
### Dependencies
|
|
15
|
+
|
|
16
|
+
* Require Rainbow 3.x ([#1821] by [mvz])
|
|
17
|
+
* Add Ruby 4.0 to CI ([#1827] by [etagwerker])
|
|
18
|
+
* Support Ruby 3.2 and up ([#1842] by [mvz])
|
|
19
|
+
|
|
20
|
+
### Internal
|
|
21
|
+
|
|
22
|
+
* Remove unused documention quality specs ([#1803] by [mvz])
|
|
23
|
+
* Use documented form of platform syntax in Gemfile ([#1810] by [mvz])
|
|
24
|
+
|
|
25
|
+
[dancristianb]: https://github.com/dancristianb
|
|
26
|
+
[etagwerker]: https://github.com/etagwerker
|
|
27
|
+
|
|
28
|
+
[#1803]: https://github.com/troessner/reek/pull/1803
|
|
29
|
+
[#1810]: https://github.com/troessner/reek/pull/1810
|
|
30
|
+
[#1821]: https://github.com/troessner/reek/pull/1821
|
|
31
|
+
[#1823]: https://github.com/troessner/reek/pull/1823
|
|
32
|
+
[#1826]: https://github.com/troessner/reek/pull/1826
|
|
33
|
+
[#1827]: https://github.com/troessner/reek/pull/1827
|
|
34
|
+
[#1828]: https://github.com/troessner/reek/pull/1828
|
|
35
|
+
[#1829]: https://github.com/troessner/reek/pull/1829
|
|
36
|
+
[#1842]: https://github.com/troessner/reek/pull/1842
|
|
37
|
+
|
|
4
38
|
## 6.5.0 (2025-03-24)
|
|
5
39
|
|
|
6
40
|
### Features and bugfixes
|
data/Gemfile
CHANGED
|
@@ -4,19 +4,17 @@ source 'https://rubygems.org'
|
|
|
4
4
|
|
|
5
5
|
gemspec
|
|
6
6
|
|
|
7
|
-
gem 'aruba', '~> 2.
|
|
7
|
+
gem 'aruba', '~> 2.3'
|
|
8
8
|
gem 'codeclimate-engine-rb', '~> 0.4.0'
|
|
9
|
-
gem 'cucumber', '
|
|
10
|
-
gem 'kramdown', '~> 2.1'
|
|
11
|
-
gem 'kramdown-parser-gfm', '~> 1.0'
|
|
9
|
+
gem 'cucumber', ['>= 10.0', '< 12.0']
|
|
12
10
|
gem 'rake', '~> 13.0'
|
|
13
11
|
gem 'rspec', '~> 3.0'
|
|
14
12
|
gem 'rspec-benchmark', '~> 0.6.0'
|
|
15
|
-
gem 'rubocop', '~> 1.
|
|
16
|
-
gem 'rubocop-performance', '~> 1.
|
|
17
|
-
gem 'rubocop-rspec', '~> 3.
|
|
18
|
-
gem 'simplecov', '~>
|
|
13
|
+
gem 'rubocop', '~> 1.90'
|
|
14
|
+
gem 'rubocop-performance', '~> 1.27'
|
|
15
|
+
gem 'rubocop-rspec', '~> 3.10'
|
|
16
|
+
gem 'simplecov', '~> 1.0'
|
|
19
17
|
gem 'yard', '~> 0.9.5'
|
|
20
18
|
|
|
21
19
|
# Needed for YARD to properly parse GFM code blocks in the documentation
|
|
22
|
-
gem 'redcarpet', '~> 3.4',
|
|
20
|
+
gem 'redcarpet', '~> 3.4', platforms: [:mri]
|
data/README.md
CHANGED
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
* 
|
|
43
43
|
* [](https://inch-ci.org/github/troessner/reek)
|
|
44
44
|
* [](https://codeclimate.com/github/troessner/reek)
|
|
45
|
-
* [](https://codebeat.co/projects/github-com-troessner-reek)
|
|
46
45
|
|
|
47
46
|
|
|
48
47
|
## Quickstart
|
data/bin/code_climate_reek
CHANGED
|
@@ -9,109 +9,111 @@ require_relative '../lib/reek/cli/application'
|
|
|
9
9
|
require_relative '../lib/reek/code_climate'
|
|
10
10
|
Reek::CLI::Silencer.silently { require 'parser/current' }
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
12
|
+
module CodeClimateReek
|
|
13
|
+
# Map input coming from CodeClimate to Reek.
|
|
14
|
+
class CodeClimateToReek
|
|
15
|
+
# Following the spec (https://github.com/codeclimate/spec/blob/master/SPEC.md)
|
|
16
|
+
# we have to exit with a zero for both failure and success.
|
|
17
|
+
ENGINE_CONFIGURATION = [
|
|
18
|
+
'--failure-exit-code', '0',
|
|
19
|
+
'--success-exit-code', '0'
|
|
20
|
+
].freeze
|
|
21
|
+
CUSTOM_CONFIG_KEY = 'config'
|
|
22
|
+
CUSTOM_CONFIG_TARGET_RUBY_VERSION_KEY = 'target_ruby_version'
|
|
23
|
+
|
|
24
|
+
attr_reader :configuration_file_path, :include_paths_key, :include_paths_default
|
|
25
|
+
|
|
26
|
+
def initialize(configuration_file_path: '/config.json',
|
|
27
|
+
include_paths_key: 'include_paths',
|
|
28
|
+
include_paths_default: ['.'])
|
|
29
|
+
@configuration_file_path = configuration_file_path
|
|
30
|
+
@include_paths_key = include_paths_key
|
|
31
|
+
@include_paths_default = include_paths_default
|
|
32
|
+
end
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
def cli_arguments
|
|
35
|
+
include_paths + ENGINE_CONFIGURATION
|
|
36
|
+
end
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
def target_ruby_version
|
|
39
|
+
config.dig(CUSTOM_CONFIG_KEY, CUSTOM_CONFIG_TARGET_RUBY_VERSION_KEY)
|
|
40
|
+
end
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
private
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
def configuration_file_exists?
|
|
45
|
+
Pathname.new(configuration_file_path).exist?
|
|
46
|
+
end
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
# The config.json file we try to read below might look like this:
|
|
49
|
+
# {
|
|
50
|
+
# "include_paths":[
|
|
51
|
+
# "lib",
|
|
52
|
+
# "spec"
|
|
53
|
+
# ]
|
|
54
|
+
# }
|
|
55
|
+
def include_paths
|
|
56
|
+
config.fetch include_paths_key, include_paths_default
|
|
57
|
+
end
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
def config
|
|
60
|
+
if configuration_file_exists?
|
|
61
|
+
JSON.parse File.read(configuration_file_path)
|
|
62
|
+
else
|
|
63
|
+
{}
|
|
64
|
+
end
|
|
63
65
|
end
|
|
64
66
|
end
|
|
65
|
-
end
|
|
66
67
|
|
|
67
|
-
# Override for ReportCommand to force the use of CodeClimateReport.
|
|
68
|
-
module ReportClassOverride
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
# Override for ReportCommand to force the use of CodeClimateReport.
|
|
69
|
+
module ReportClassOverride
|
|
70
|
+
def report_class
|
|
71
|
+
Reek::CodeClimate::CodeClimateReport
|
|
72
|
+
end
|
|
71
73
|
end
|
|
72
|
-
end
|
|
73
74
|
|
|
74
|
-
# Override Reek::Source::SourceCode to use a parser version specified by the user
|
|
75
|
-
module SourceCodeOverride
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
# Override Reek::Source::SourceCode to use a parser version specified by the user
|
|
76
|
+
module SourceCodeOverride
|
|
77
|
+
# override self.default_parser method
|
|
78
|
+
def default_parser
|
|
79
|
+
parser_class.new(Reek::AST::Builder.new).tap do |parser|
|
|
80
|
+
diagnostics = parser.diagnostics
|
|
81
|
+
diagnostics.all_errors_are_fatal = true
|
|
82
|
+
diagnostics.ignore_warnings = true
|
|
83
|
+
end
|
|
82
84
|
end
|
|
83
|
-
end
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
86
|
+
# config.json file will look like this:
|
|
87
|
+
# {
|
|
88
|
+
# "include_paths":[
|
|
89
|
+
# "lib",
|
|
90
|
+
# "spec"
|
|
91
|
+
# ],
|
|
92
|
+
# "config": {
|
|
93
|
+
# "target_ruby_version": "3.1.0"
|
|
94
|
+
# }
|
|
95
|
+
# }
|
|
96
|
+
def parser_class
|
|
97
|
+
# convert an X.Y.Z version number to an XY two digit number
|
|
98
|
+
requested_version = CodeClimateToReek.new.target_ruby_version
|
|
99
|
+
return Parser::CurrentRuby if requested_version.nil?
|
|
100
|
+
|
|
101
|
+
version_number = Gem::Version.new(requested_version).segments[0..1].join
|
|
102
|
+
|
|
103
|
+
begin
|
|
104
|
+
Reek::CLI::Silencer.silently { require "parser/ruby#{version_number}" }
|
|
105
|
+
Module.const_get("Parser::Ruby#{version_number}")
|
|
106
|
+
rescue LoadError, NameError
|
|
107
|
+
# use Parser::CurrentRuby when an invalid version number is provided
|
|
108
|
+
Parser::CurrentRuby
|
|
109
|
+
end
|
|
108
110
|
end
|
|
109
111
|
end
|
|
110
112
|
end
|
|
111
113
|
|
|
112
|
-
Reek::CLI::Command::ReportCommand.prepend ReportClassOverride
|
|
113
|
-
Reek::Source::SourceCode.singleton_class.prepend SourceCodeOverride
|
|
114
|
+
Reek::CLI::Command::ReportCommand.prepend CodeClimateReek::ReportClassOverride
|
|
115
|
+
Reek::Source::SourceCode.singleton_class.prepend CodeClimateReek::SourceCodeOverride
|
|
114
116
|
|
|
115
|
-
application = Reek::CLI::Application.new(CodeClimateToReek.new.cli_arguments)
|
|
117
|
+
application = Reek::CLI::Application.new(CodeClimateReek::CodeClimateToReek.new.cli_arguments)
|
|
116
118
|
|
|
117
119
|
exit application.execute
|
data/lib/reek/ast/node.rb
CHANGED
|
@@ -60,7 +60,7 @@ module Reek
|
|
|
60
60
|
#
|
|
61
61
|
# @example
|
|
62
62
|
# node.each_node(:send, [:mlhs]) do |call_node| .... end
|
|
63
|
-
# node.each_node(:lvar).any? {
|
|
63
|
+
# node.each_node(:lvar).any? { _1.var_name == 'something' }
|
|
64
64
|
# node.each_node([:block]).flat_map do |elem| ... end
|
|
65
65
|
#
|
|
66
66
|
# Returns an array with all matching nodes.
|
|
@@ -95,7 +95,7 @@ module Reek
|
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
# Utility methods for :forward_args nodes.
|
|
98
|
-
# rubocop:disable Naming/ClassAndModuleCamelCase
|
|
98
|
+
# rubocop:disable-next Naming/ClassAndModuleCamelCase
|
|
99
99
|
module Forward_ArgsNode
|
|
100
100
|
include ArgNodeBase
|
|
101
101
|
|
|
@@ -103,10 +103,9 @@ module Reek
|
|
|
103
103
|
true
|
|
104
104
|
end
|
|
105
105
|
end
|
|
106
|
-
# rubocop:enable Naming/ClassAndModuleCamelCase
|
|
107
106
|
|
|
108
107
|
# Utility methods for :forward_arg nodes.
|
|
109
|
-
# rubocop:disable Naming/ClassAndModuleCamelCase
|
|
108
|
+
# rubocop:disable-next Naming/ClassAndModuleCamelCase
|
|
110
109
|
module Forward_ArgNode
|
|
111
110
|
include ArgNodeBase
|
|
112
111
|
|
|
@@ -114,7 +113,6 @@ module Reek
|
|
|
114
113
|
true
|
|
115
114
|
end
|
|
116
115
|
end
|
|
117
|
-
# rubocop:enable Naming/ClassAndModuleCamelCase
|
|
118
116
|
|
|
119
117
|
# Utility methods for :kwnilarg nodes.
|
|
120
118
|
module KwnilargNode
|
|
@@ -12,7 +12,7 @@ module Reek
|
|
|
12
12
|
# your keys and types
|
|
13
13
|
Dry::Schema.load_extensions(:info)
|
|
14
14
|
|
|
15
|
-
# rubocop:disable Metrics/BlockLength
|
|
15
|
+
# rubocop:disable-next Metrics/BlockLength
|
|
16
16
|
ALL_DETECTORS_SCHEMA = Dry::Schema.Params do
|
|
17
17
|
optional(:Attribute).filled(:hash) do
|
|
18
18
|
optional(:enabled).filled(:bool)
|
|
@@ -158,7 +158,6 @@ module Reek
|
|
|
158
158
|
optional(:public_methods_only).filled(:bool)
|
|
159
159
|
end
|
|
160
160
|
end
|
|
161
|
-
# rubocop:enable Metrics/BlockLength
|
|
162
161
|
|
|
163
162
|
# @quality :reek:TooManyStatements { max_statements: 7 }
|
|
164
163
|
def self.schema(directories = [])
|
data/lib/reek/context_builder.rb
CHANGED
|
@@ -494,8 +494,8 @@ module Reek
|
|
|
494
494
|
# @param args arguments for the class initializer
|
|
495
495
|
# @yield block
|
|
496
496
|
#
|
|
497
|
-
def inside_new_context(klass, *
|
|
498
|
-
new_context = append_new_context(klass, *
|
|
497
|
+
def inside_new_context(klass, *)
|
|
498
|
+
new_context = append_new_context(klass, *)
|
|
499
499
|
|
|
500
500
|
orig, self.current_context = current_context, new_context
|
|
501
501
|
yield
|
data/lib/reek/rake/task.rb
CHANGED
|
@@ -69,14 +69,19 @@ module Reek
|
|
|
69
69
|
|
|
70
70
|
# @public
|
|
71
71
|
def initialize(name = :reek)
|
|
72
|
-
@config_file = ENV.fetch('REEK_CFG', nil)
|
|
73
72
|
@name = name
|
|
74
|
-
@reek_opts =
|
|
73
|
+
@reek_opts = ''
|
|
75
74
|
@fail_on_error = true
|
|
76
75
|
@verbose = false
|
|
77
76
|
|
|
78
77
|
yield self if block_given?
|
|
79
78
|
|
|
79
|
+
if (reek_cfg = ENV.fetch('REEK_CFG', nil))
|
|
80
|
+
@config_file = reek_cfg
|
|
81
|
+
end
|
|
82
|
+
if (reek_opts = ENV.fetch('REEK_OPTS', nil))
|
|
83
|
+
@reek_opts = reek_opts
|
|
84
|
+
end
|
|
80
85
|
if (reek_src = ENV.fetch('REEK_SRC', nil))
|
|
81
86
|
@source_files = FileList[reek_src]
|
|
82
87
|
end
|
|
@@ -62,7 +62,7 @@ module Reek
|
|
|
62
62
|
|
|
63
63
|
def total_smell_count_message
|
|
64
64
|
colour = smells? ? WARNINGS_COLOR : NO_WARNINGS_COLOR
|
|
65
|
-
Rainbow("#{total_smell_count} total warning#{total_smell_count == 1
|
|
65
|
+
Rainbow("#{total_smell_count} total warning#{'s' unless total_smell_count == 1}\n").color(colour)
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
end
|
|
@@ -75,7 +75,7 @@ module Reek
|
|
|
75
75
|
# @return [Boolean] if the parameter is used in the given method call
|
|
76
76
|
#
|
|
77
77
|
def call_involving_param?(call_node)
|
|
78
|
-
call_node.each_node(:lvar).any? {
|
|
78
|
+
call_node.each_node(:lvar).any? { _1.var_name == parameter }
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
#
|
|
@@ -64,7 +64,7 @@ module Reek
|
|
|
64
64
|
# @return [Array<Iterator>]
|
|
65
65
|
#
|
|
66
66
|
def find_violations
|
|
67
|
-
find_candidates.select {
|
|
67
|
+
find_candidates.select { _1.depth > max_allowed_nesting }
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
# Finds the set of independent most deeply nested iterators regardless of
|
|
@@ -71,7 +71,7 @@ module Reek
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
def involves_nil?(call)
|
|
74
|
-
call.participants.any? {
|
|
74
|
+
call.participants.any? { _1.type == :nil }
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
def comparison_methods
|
|
@@ -84,7 +84,7 @@ module Reek
|
|
|
84
84
|
module_function
|
|
85
85
|
|
|
86
86
|
def detect(node)
|
|
87
|
-
node.condition_list.any? {
|
|
87
|
+
node.condition_list.any? { _1.type == :nil }
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
end
|
|
@@ -35,7 +35,7 @@ module Reek
|
|
|
35
35
|
# @return [Array<SmellWarning>]
|
|
36
36
|
#
|
|
37
37
|
def sniff
|
|
38
|
-
count = context.local_nodes(:casgn).count { |
|
|
38
|
+
count = context.local_nodes(:casgn).count { |node| !node.defines_module? }
|
|
39
39
|
|
|
40
40
|
return [] if count <= max_allowed_constants
|
|
41
41
|
|
data/lib/reek/version.rb
CHANGED
data/reek.gemspec
CHANGED
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
|
|
24
24
|
spec.executables = spec.files.grep(%r{^bin/}).map { |path| File.basename(path) }
|
|
25
25
|
spec.rdoc_options = %w(--main README.md -x assets/|bin/|config/|features/|spec/|tasks/)
|
|
26
|
-
spec.required_ruby_version = '>= 3.
|
|
26
|
+
spec.required_ruby_version = '>= 3.2.0'
|
|
27
27
|
|
|
28
28
|
spec.metadata = {
|
|
29
29
|
'homepage_uri' => 'https://github.com/troessner/reek',
|
|
@@ -37,6 +37,6 @@ Gem::Specification.new do |spec|
|
|
|
37
37
|
spec.add_dependency 'dry-schema', '~> 1.13'
|
|
38
38
|
spec.add_dependency 'logger', '~> 1.6'
|
|
39
39
|
spec.add_dependency 'parser', '~> 3.3.0'
|
|
40
|
-
spec.add_dependency 'rainbow', '
|
|
40
|
+
spec.add_dependency 'rainbow', '~> 3.0'
|
|
41
41
|
spec.add_dependency 'rexml', '~> 3.1'
|
|
42
42
|
end
|
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: reek
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.6.0
|
|
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:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: dry-schema
|
|
@@ -59,22 +58,16 @@ dependencies:
|
|
|
59
58
|
name: rainbow
|
|
60
59
|
requirement: !ruby/object:Gem::Requirement
|
|
61
60
|
requirements:
|
|
62
|
-
- - "
|
|
63
|
-
- !ruby/object:Gem::Version
|
|
64
|
-
version: '2.0'
|
|
65
|
-
- - "<"
|
|
61
|
+
- - "~>"
|
|
66
62
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '
|
|
63
|
+
version: '3.0'
|
|
68
64
|
type: :runtime
|
|
69
65
|
prerelease: false
|
|
70
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
67
|
requirements:
|
|
72
|
-
- - "
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '2.0'
|
|
75
|
-
- - "<"
|
|
68
|
+
- - "~>"
|
|
76
69
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: '
|
|
70
|
+
version: '3.0'
|
|
78
71
|
- !ruby/object:Gem::Dependency
|
|
79
72
|
name: rexml
|
|
80
73
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -274,7 +267,6 @@ metadata:
|
|
|
274
267
|
changelog_uri: https://github.com/troessner/reek/CHANGELOG.md
|
|
275
268
|
documentation_uri: https://www.rubydoc.info/gems/reek
|
|
276
269
|
rubygems_mfa_required: 'true'
|
|
277
|
-
post_install_message:
|
|
278
270
|
rdoc_options:
|
|
279
271
|
- "--main"
|
|
280
272
|
- README.md
|
|
@@ -286,15 +278,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
286
278
|
requirements:
|
|
287
279
|
- - ">="
|
|
288
280
|
- !ruby/object:Gem::Version
|
|
289
|
-
version: 3.
|
|
281
|
+
version: 3.2.0
|
|
290
282
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
283
|
requirements:
|
|
292
284
|
- - ">="
|
|
293
285
|
- !ruby/object:Gem::Version
|
|
294
286
|
version: '0'
|
|
295
287
|
requirements: []
|
|
296
|
-
rubygems_version:
|
|
297
|
-
signing_key:
|
|
288
|
+
rubygems_version: 4.0.22
|
|
298
289
|
specification_version: 4
|
|
299
290
|
summary: Code smell detector for Ruby
|
|
300
291
|
test_files: []
|