reek 6.0.1 → 6.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 107593e309020bb2745d630599f8bf33bde2c9f708877895465cd12360267f82
4
- data.tar.gz: 61290a2608c069e4c5977720e5a1d99fe8d4e716dfaa8503c0491b226790a8a7
3
+ metadata.gz: 83760bf0344db6b8f65cd5bbb6e57f90ee4e1b54c10edb3920821a517e6649cd
4
+ data.tar.gz: 258214d9022fda0ecbe287c4313719472c30f056c1ff6ffd4f7ff023b255b199
5
5
  SHA512:
6
- metadata.gz: '09025ee922070bcb0c415f82fd5591e6658610a661ae4fc24abb472f16df6c3ed222fcfd84f81500a1951cadfabfb33b5c9414e26164f67cc140699774a9d2e7'
7
- data.tar.gz: 7b9af8e1a09c5722fbedd946389411dee5aa7a5b98f03f48330a9d7f76d4c126bf170fff94955af6abe7a3a6c2e4b1b046c1fd1b8e304ee678a0fbecb52919f1
6
+ metadata.gz: 56c12a16cc200dd475d84a543fd9edf2ce888f550a5d4d22cbe813c3439ed0915263340d7c02654417666bcd728ee5e9ba976670cae46098293b58595589f36c
7
+ data.tar.gz: 0f012f16ec237bdece4f797ea2977c0db5fa083df32ac86ce57b14911777eec0d832aff8e861df67c5cc80b847b0c3caf801a157b759724cc9f858ae4236ace9
@@ -9,6 +9,7 @@ AllCops:
9
9
  - 'samples/**/*'
10
10
  - 'tmp/**/*'
11
11
  - 'vendor/**/*'
12
+ NewCops: enable
12
13
  TargetRubyVersion: 2.4
13
14
 
14
15
  # Tables are nice
@@ -57,6 +58,7 @@ Lint/BooleanSymbol:
57
58
  # Spec blocks can be any size
58
59
  Metrics/BlockLength:
59
60
  Exclude:
61
+ - '**/*.gemspec'
60
62
  - 'spec/**/*'
61
63
 
62
64
  # Keyword arguments make long parameter lists readable
@@ -130,23 +132,3 @@ Style/WordArray:
130
132
  Metrics/ClassLength:
131
133
  Exclude:
132
134
  - 'lib/reek/cli/options.rb'
133
-
134
- # Activate new cops from RuboCop 0.80 - 0.83
135
- Lint/RaiseException:
136
- Enabled: true
137
- Lint/StructNewOverride:
138
- Enabled: true
139
- Layout/EmptyLinesAroundAttributeAccessor:
140
- Enabled: true
141
- Layout/SpaceAroundMethodCallOperator:
142
- Enabled: true
143
- Style/ExponentialNotation:
144
- Enabled: true
145
- Style/HashEachMethods:
146
- Enabled: true
147
- Style/HashTransformKeys:
148
- Enabled: true
149
- Style/HashTransformValues:
150
- Enabled: true
151
- Style/SlicingWithRange:
152
- Enabled: true
@@ -1,22 +1,34 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2019-12-22 13:19:30 +0100 using RuboCop version 0.78.0.
3
+ # on 2020-08-19 19:02:50 UTC using RuboCop version 0.89.1.
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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 3
9
+ # Offense count: 2
10
+ Lint/MissingSuper:
11
+ Exclude:
12
+ - 'lib/reek/rake/task.rb'
13
+ - 'lib/reek/smell_detectors/base_detector.rb'
14
+
15
+ # Offense count: 2
16
+ Lint/UnreachableLoop:
17
+ Exclude:
18
+ - 'spec/reek/ast/node_spec.rb'
19
+
20
+ # Offense count: 2
21
+ # Configuration parameters: IgnoredMethods.
10
22
  Metrics/AbcSize:
11
23
  Max: 21
12
24
 
13
25
  # Offense count: 1
14
- # Configuration parameters: CountComments.
26
+ # Configuration parameters: CountComments, CountAsOne.
15
27
  Metrics/ClassLength:
16
28
  Max: 161
17
29
 
18
- # Offense count: 14
19
- # Configuration parameters: CountComments, ExcludedMethods.
30
+ # Offense count: 13
31
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
20
32
  Metrics/MethodLength:
21
33
  Max: 16
22
34
 
@@ -25,17 +37,6 @@ RSpec/AnyInstance:
25
37
  Exclude:
26
38
  - 'spec/reek/cli/application_spec.rb'
27
39
 
28
- # Offense count: 1
29
- # Configuration parameters: CustomIncludeMethods.
30
- RSpec/EmptyExampleGroup:
31
- Exclude:
32
- - 'spec/factories/factories.rb'
33
-
34
- # Offense count: 1
35
- RSpec/MissingExampleGroupArgument:
36
- Exclude:
37
- - 'spec/factories/factories.rb'
38
-
39
40
  # Offense count: 4
40
41
  RSpec/MultipleDescribes:
41
42
  Exclude:
@@ -44,12 +45,16 @@ RSpec/MultipleDescribes:
44
45
  - 'spec/reek/report/location_formatter_spec.rb'
45
46
  - 'spec/reek/report/progress_formatter_spec.rb'
46
47
 
47
- # Offense count: 32
48
- # Configuration parameters: AggregateFailuresByDefault.
48
+ # Offense count: 30
49
49
  RSpec/MultipleExpectations:
50
50
  Max: 5
51
51
 
52
- # Offense count: 25
52
+ # Offense count: 16
53
+ # Configuration parameters: AllowSubject.
54
+ RSpec/MultipleMemoizedHelpers:
55
+ Max: 9
56
+
57
+ # Offense count: 27
53
58
  RSpec/NestedGroups:
54
59
  Max: 5
55
60
 
@@ -34,3 +34,7 @@ notifications:
34
34
  branches:
35
35
  only:
36
36
  - master
37
+
38
+ env:
39
+ global:
40
+ - JRUBY_OPTS="--dev"
@@ -1,5 +1,12 @@
1
1
  # Change log
2
2
 
3
+ ## 6.0.2 (2020-10-17)
4
+
5
+ * (mvz) Loosen dependency on psych. This should resolve installation problems on
6
+ mingw32
7
+ * (Cesario Uy) Fix typo in docs for "Boolean Parameter" smell
8
+ * (mvz) Set link metadata in gemspec
9
+
3
10
  ## 6.0.1 (2020-05-26)
4
11
 
5
12
  * (Maxim Pertsov) Handle absolute paths for directories correctly
data/Gemfile CHANGED
@@ -7,16 +7,16 @@ ruby RUBY_VERSION
7
7
  group :development do
8
8
  gem 'aruba', '~> 1.0'
9
9
  gem 'codeclimate-engine-rb', '~> 0.4.0'
10
- gem 'cucumber', '~> 3.0'
10
+ gem 'cucumber', ['>= 4.0', '< 6.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', '~> 0.83.0'
17
- gem 'rubocop-performance', '~> 1.5.0'
18
- gem 'rubocop-rspec', '~> 1.39.0'
19
- gem 'simplecov', '~> 0.18.1'
16
+ gem 'rubocop', '~> 0.93.0'
17
+ gem 'rubocop-performance', '~> 1.8.0'
18
+ gem 'rubocop-rspec', '~> 1.43.1'
19
+ gem 'simplecov', ['>= 0.18.0', '< 0.20.0']
20
20
  gem 'yard', '~> 0.9.5'
21
21
 
22
22
  platforms :mri do
data/README.md CHANGED
@@ -373,7 +373,7 @@ are documented in the corresponding smell type /docs page (if you want to get a
373
373
  configurations you can also check out [the `defaults.reek.yml` file in this repository](docs/defaults.reek.yml).
374
374
 
375
375
  Note that you do not need a configuration file at all.
376
- If you're fine with all the [defaults.reek.yml](docs/defaults.reek.yml) we set you can skip this completely.
376
+ If you're fine with all the [defaults](docs/defaults.reek.yml) we set you can skip this completely.
377
377
 
378
378
  Don't worry about introducing a mistake in your configuration file that might go unnoticed - Reek uses a
379
379
  schema to validate your configuration against on start up and will faily loudly in case you
@@ -38,7 +38,7 @@ Note that both smells are reported, _Boolean Parameter_ and _Control Parameter_.
38
38
 
39
39
  ## Getting rid of the smell
40
40
 
41
- This is highly dependant on your exact architecture, but looking at the example above what you could do is:
41
+ This is highly dependent on your exact architecture, but looking at the example above what you could do is:
42
42
 
43
43
  * Move everything in the `if` branch into a separate method
44
44
  * Move everything in the `else` branch into a separate method
@@ -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/v6.0.1/docs/Code-Smells.md for a list of smells
46
+ Check out https://github.com/troessner/reek/blob/v6.0.2/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:
@@ -119,5 +119,5 @@ Feature: Reek can be controlled using command-line options
119
119
  UnusedPrivateMethod
120
120
  UtilityFunction
121
121
 
122
- Check out https://github.com/troessner/reek/blob/v6.0.1/docs/Code-Smells.md for a details on each detector
122
+ Check out https://github.com/troessner/reek/blob/v6.0.2/docs/Code-Smells.md for a details on each detector
123
123
  """
@@ -6,7 +6,7 @@ Feature: Validate schema
6
6
  Scenario: Our generated default configuration
7
7
  Given our default configuration file
8
8
  And the clean file "clean.rb"
9
- When I run reek -c defaults.reek clean.rb
9
+ When I run reek -c defaults.reek.yml clean.rb
10
10
  Then it succeeds
11
11
  And it reports nothing
12
12
 
@@ -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/v6.0.1/docs/Uncommunicative-Method-Name.md",
27
+ "documentation_link": "https://github.com/troessner/reek/blob/v6.0.2/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/v6.0.1/docs/Uncommunicative-Variable-Name.md",
36
+ "documentation_link": "https://github.com/troessner/reek/blob/v6.0.2/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/v6.0.1/docs/Irresponsible-Module.md"
56
+ "documentation_link": "https://github.com/troessner/reek/blob/v6.0.2/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/v6.0.1/docs/Uncommunicative-Method-Name.md]
186
- [5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v6.0.1/docs/Uncommunicative-Variable-Name.md]
185
+ [4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/v6.0.2/docs/Uncommunicative-Method-Name.md]
186
+ [5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v6.0.2/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/v6.0.1/docs/Uncommunicative-Method-Name.md]
213
- UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v6.0.1/docs/Uncommunicative-Variable-Name.md]
212
+ UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/v6.0.2/docs/Uncommunicative-Method-Name.md]
213
+ UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v6.0.2/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/v6.0.1/docs/Uncommunicative-Method-Name.md
28
+ documentation_link: https://github.com/troessner/reek/blob/v6.0.2/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/v6.0.1/docs/Uncommunicative-Variable-Name.md
36
+ documentation_link: https://github.com/troessner/reek/blob/v6.0.2/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/v6.0.1/docs/Irresponsible-Module.md
51
+ documentation_link: https://github.com/troessner/reek/blob/v6.0.2/docs/Irresponsible-Module.md
52
52
  """
@@ -6,7 +6,7 @@ When 'I run the code climate reek runner' do
6
6
  run_command_and_stop 'code_climate_reek'
7
7
  end
8
8
 
9
- When /^I pass "([^\"]*)" to reek *(.*)$/ do |stdin, args|
9
+ When /^I pass "([^"]*)" to reek *(.*)$/ do |stdin, args|
10
10
  reek_with_pipe(stdin, args)
11
11
  end
12
12
 
@@ -44,8 +44,8 @@ Given(/^a configuration file '(.+)'$/) do |filename|
44
44
  end
45
45
 
46
46
  Given(/^our default configuration file$/) do
47
- default_configuration = File.read SAMPLES_DIR.join('..').join('docs').join('defaults.reek.yml')
48
- write_file('defaults.reek', default_configuration)
47
+ default_configuration = File.read Reek::DEFAULT_SMELL_CONFIGURATION
48
+ write_file('defaults.reek.yml', default_configuration)
49
49
  end
50
50
 
51
51
  When(/^I run "reek (.*?)" in a subdirectory$/) do |args|
@@ -8,6 +8,7 @@ require_relative 'reek/examiner'
8
8
  require_relative 'reek/report'
9
9
 
10
10
  module Reek
11
+ DEFAULT_SMELL_CONFIGURATION = File.join(__dir__, '../docs/defaults.reek.yml').freeze
11
12
  DEFAULT_CONFIGURATION_FILE_NAME = '.reek.yml'
12
13
  DETECTORS_KEY = 'detectors'
13
14
  EXCLUDE_PATHS_KEY = 'exclude_paths'
@@ -87,7 +87,7 @@ module Reek
87
87
 
88
88
  def set_banner
89
89
  program_name = parser.program_name
90
- parser.banner = <<-BANNER.gsub(/^[ ]+/, '')
90
+ parser.banner = <<-BANNER.gsub(/^ +/, '')
91
91
  Usage: #{program_name} [options] [files]
92
92
 
93
93
  Examples:
@@ -72,11 +72,12 @@ module Reek
72
72
 
73
73
  def load_values(values)
74
74
  values.each do |key, value|
75
- if key == EXCLUDE_PATHS_KEY
75
+ case key
76
+ when EXCLUDE_PATHS_KEY
76
77
  excluded_paths.add value
77
- elsif key == DIRECTORIES_KEY
78
+ when DIRECTORIES_KEY
78
79
  directory_directives.add value
79
- elsif key == DETECTORS_KEY
80
+ when DETECTORS_KEY
80
81
  default_directive.add value
81
82
  end
82
83
  end
@@ -84,7 +84,7 @@ module Reek
84
84
  gsub('<<to_eol_wildcards>>', '.*').
85
85
  gsub('<<to_wildcards>>', '.*')
86
86
  else
87
- glob + '.*'
87
+ "#{glob}.*"
88
88
  end
89
89
 
90
90
  Regexp.new("^#{regexp}$", Regexp::IGNORECASE)
@@ -92,7 +92,7 @@ module Reek
92
92
 
93
93
  def error_message_for_invalid_smell_type(klass)
94
94
  "You are trying to configure smell type #{klass} but we can't find one with that name.\n" \
95
- "Please make sure you spelled it right. (See 'docs/defaults.reek' in the Reek\n" \
95
+ "Please make sure you spelled it right. (See 'docs/defaults.reek.yml' in the Reek\n" \
96
96
  'repository for a list of all available smell types.)'
97
97
  end
98
98
  end
@@ -66,6 +66,8 @@ module Reek
66
66
  CodeComment.new(comment: exp.leading_comment).descriptive?
67
67
  end
68
68
 
69
+ CONSTANT_SEXP_TYPES = [:casgn, :class, :module].freeze
70
+
69
71
  # A namespace module is a module (or class) that is only there for namespacing
70
72
  # purposes, and thus contains only nested constants, modules or classes.
71
73
  #
@@ -78,7 +80,7 @@ module Reek
78
80
  return false if exp.type == :casgn
79
81
 
80
82
  children = exp.direct_children
81
- children.any? && children.all? { |child| [:casgn, :class, :module].include? child.type }
83
+ children.any? && children.all? { |child| CONSTANT_SEXP_TYPES.include? child.type }
82
84
  end
83
85
 
84
86
  def track_visibility(visibility, names)
@@ -59,7 +59,7 @@ BooleanParameter:
59
59
 
60
60
  ## Getting rid of the smell
61
61
 
62
- This is highly dependant on your exact architecture, but looking at the example above what you could do is:
62
+ This is highly dependent on your exact architecture, but looking at the example above what you could do is:
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
@@ -14,6 +14,8 @@ module Reek
14
14
  #
15
15
  # See {file:docs/Boolean-Parameter.md} for details.
16
16
  class BooleanParameter < BaseDetector
17
+ BOOLEAN_VALUES = [:true, :false].freeze
18
+
17
19
  #
18
20
  # Checks whether the given method has any Boolean parameters.
19
21
  #
@@ -21,7 +23,7 @@ module Reek
21
23
  #
22
24
  def sniff
23
25
  context.default_assignments.select do |_parameter, value|
24
- [:true, :false].include?(value.type)
26
+ BOOLEAN_VALUES.include?(value.type)
25
27
  end.map do |parameter, _value|
26
28
  smell_warning(
27
29
  lines: [source_line],
@@ -74,7 +74,7 @@ module Reek
74
74
  end
75
75
 
76
76
  def uncommunicative_variable_name?(name)
77
- sanitized_name = name.to_s.gsub(/^[@\*\&]*/, '')
77
+ sanitized_name = name.to_s.gsub(/^[@*&]*/, '')
78
78
  !acceptable_name?(sanitized_name)
79
79
  end
80
80
 
@@ -31,8 +31,7 @@ module Reek
31
31
  # public API.
32
32
  #
33
33
  # @quality :reek:LongParameterList { max_params: 6 }
34
- def initialize(smell_type, context: '', lines:, message:,
35
- source:, parameters: {})
34
+ def initialize(smell_type, lines:, message:, source:, context: '', parameters: {})
36
35
  @smell_type = smell_type
37
36
  @source = source
38
37
  @context = context.to_s
@@ -33,23 +33,26 @@ module Reek
33
33
 
34
34
  attr_reader :configuration, :paths, :options
35
35
 
36
- # @quality :reek:TooManyStatements { max_statements: 7 }
37
- # @quality :reek:NestedIterators { max_allowed_nesting: 2 }
38
36
  def source_paths
39
37
  paths.each_with_object([]) do |given_path, relevant_paths|
40
- unless given_path.exist?
38
+ if given_path.exist?
39
+ relevant_paths.concat source_files_from_path(given_path)
40
+ else
41
41
  print_no_such_file_error(given_path)
42
- next
43
42
  end
43
+ end
44
+ end
44
45
 
45
- given_path.find do |path|
46
- if path.directory?
47
- ignore_path?(path) ? Find.prune : next
48
- elsif ruby_file?(path)
49
- relevant_paths << path unless ignore_file?(path)
50
- end
46
+ def source_files_from_path(given_path)
47
+ relevant_paths = []
48
+ given_path.find do |path|
49
+ if path.directory?
50
+ Find.prune if ignore_path?(path)
51
+ elsif ruby_file?(path)
52
+ relevant_paths << path unless ignore_file?(path)
51
53
  end
52
54
  end
55
+ relevant_paths
53
56
  end
54
57
 
55
58
  def ignore_file?(path)
@@ -8,6 +8,6 @@ module Reek
8
8
  # @public
9
9
  module Version
10
10
  # @public
11
- STRING = '6.0.1'
11
+ STRING = '6.0.2'
12
12
  end
13
13
  end
@@ -19,8 +19,16 @@ Gem::Specification.new do |s|
19
19
  s.required_ruby_version = '>= 2.4.0'
20
20
  s.summary = 'Code smell detector for Ruby'
21
21
 
22
+ s.metadata = {
23
+ 'homepage_uri' => 'https://github.com/troessner/reek',
24
+ 'source_code_uri' => 'https://github.com/troessner/reek',
25
+ 'bug_tracker_uri' => 'https://github.com/troessner/reek/issues',
26
+ 'changelog_uri' => 'https://github.com/troessner/reek/CHANGELOG.md',
27
+ 'documentation_uri' => 'https://www.rubydoc.info/gems/reek'
28
+ }
29
+
22
30
  s.add_runtime_dependency 'kwalify', '~> 0.7.0'
23
31
  s.add_runtime_dependency 'parser', '< 2.8', '>= 2.5.0.0', '!= 2.5.1.1'
24
- s.add_runtime_dependency 'psych', '~> 3.1.0'
32
+ s.add_runtime_dependency 'psych', '~> 3.1'
25
33
  s.add_runtime_dependency 'rainbow', '>= 2.0', '< 4.0'
26
34
  end
@@ -6,10 +6,8 @@ RSpec.describe 'Runtime speed' do
6
6
 
7
7
  it 'runs on our smelly sources in less than 5 seconds' do
8
8
  expect do
9
- source_directory.each_entry do |entry|
10
- next if %w(. ..).include?(entry.to_s)
11
-
12
- examiner = Reek::Examiner.new entry.to_path
9
+ Dir[source_directory.join('**/*.rb')].each do |entry|
10
+ examiner = Reek::Examiner.new Pathname.new(entry)
13
11
  examiner.smells.size
14
12
  end
15
13
  end.to perform_under(5).sec
@@ -4,6 +4,7 @@ require 'kramdown'
4
4
  RSpec.describe 'Documentation' do
5
5
  root = File.expand_path('../..', __dir__)
6
6
  files = Dir.glob(File.join(root, '*.md')) + Dir.glob(File.join(root, 'docs', '*.md'))
7
+ code_types = [:codeblock, :codespan]
7
8
 
8
9
  files.each do |file|
9
10
  describe "from #{file}" do
@@ -13,7 +14,7 @@ RSpec.describe 'Documentation' do
13
14
 
14
15
  blocks.each do |block|
15
16
  # Only consider code blocks with language 'ruby'.
16
- next unless [:codeblock, :codespan].include?(block.type)
17
+ next unless code_types.include?(block.type)
17
18
  next unless block.attr['class'] == 'language-ruby'
18
19
 
19
20
  it "has a valid sample at #{block.options[:location] + 1}" do
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reek
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.1
4
+ version: 6.0.2
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: 2020-05-26 00:00:00.000000000 Z
14
+ date: 2020-10-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: kwalify
@@ -31,42 +31,42 @@ 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'
34
37
  - - ">="
35
38
  - !ruby/object:Gem::Version
36
39
  version: 2.5.0.0
37
40
  - - "!="
38
41
  - !ruby/object:Gem::Version
39
42
  version: 2.5.1.1
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '2.8'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
+ - - "<"
48
+ - !ruby/object:Gem::Version
49
+ version: '2.8'
47
50
  - - ">="
48
51
  - !ruby/object:Gem::Version
49
52
  version: 2.5.0.0
50
53
  - - "!="
51
54
  - !ruby/object:Gem::Version
52
55
  version: 2.5.1.1
53
- - - "<"
54
- - !ruby/object:Gem::Version
55
- version: '2.8'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: psych
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 3.1.0
62
+ version: '3.1'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 3.1.0
69
+ version: '3.1'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rainbow
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -465,7 +465,12 @@ files:
465
465
  homepage: https://github.com/troessner/reek
466
466
  licenses:
467
467
  - MIT
468
- metadata: {}
468
+ metadata:
469
+ homepage_uri: https://github.com/troessner/reek
470
+ source_code_uri: https://github.com/troessner/reek
471
+ bug_tracker_uri: https://github.com/troessner/reek/issues
472
+ changelog_uri: https://github.com/troessner/reek/CHANGELOG.md
473
+ documentation_uri: https://www.rubydoc.info/gems/reek
469
474
  post_install_message:
470
475
  rdoc_options:
471
476
  - "--main"
@@ -485,7 +490,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
485
490
  - !ruby/object:Gem::Version
486
491
  version: '0'
487
492
  requirements: []
488
- rubygems_version: 3.0.3
493
+ rubygems_version: 3.1.2
489
494
  signing_key:
490
495
  specification_version: 4
491
496
  summary: Code smell detector for Ruby