reek 5.5.0 → 5.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b3b65a38361c8f39a732b5902f9ee84181d3c90da8af1c4fcb7445f1b9c2471
4
- data.tar.gz: 7dc904ae5e9f98b757a7c007e1d96bf86773f6024b823cf0fe564a95304ed826
3
+ metadata.gz: da76dfc3aa1c997bffe832e526907dcf847cb5d86e04bc7c084abe074247e5d7
4
+ data.tar.gz: 7abc545f4176d0f561797c092bea15f1630b824a3d3ba37b99975450eb3ec3df
5
5
  SHA512:
6
- metadata.gz: 6534b0dd5502776c06443bcd1b9fc5047179e93511ed2ea1ea507c4566a5e5bb53b3f6bd697045771e060e1332698c6141e1437f6a26bac66db597e0d5116fd7
7
- data.tar.gz: 235d484485c0d7d01bde1acb4b268431010505f69d2a8b7fcd1ce14016cbad9854aa09b9a42ea4db0f8489b75d0c711f937b021d0140a57813e4e5774ed8a00c
6
+ metadata.gz: 7fe6f93cf2fe75c232327e1250c4e72c10c88707ce57879341f43b5a8a195ddb0282d9433e60cb19f635923edcb3fa52bbaadb187b5ee67d4b4cea7fc72ce901
7
+ data.tar.gz: a55abca10a6875077fda0b873667407f1dddf1840963fd6463ed918db9d9e58408fa93acf5a7e4741d9d488dede75963ad422c2150953e3d69f7af840a563dfd
@@ -12,7 +12,7 @@ AllCops:
12
12
  TargetRubyVersion: 2.3
13
13
 
14
14
  # Tables are nice
15
- Layout/AlignHash:
15
+ Layout/HashAlignment:
16
16
  EnforcedColonStyle: table
17
17
  EnforcedHashRocketStyle: table
18
18
  EnforcedLastArgumentHashStyle: ignore_implicit
@@ -25,6 +25,10 @@ Layout/DotPosition:
25
25
  Layout/EmptyLineBetweenDefs:
26
26
  AllowAdjacentOneLineDefs: true
27
27
 
28
+ # Be rather lenient with line length
29
+ Layout/LineLength:
30
+ Max: 120
31
+
28
32
  # Always put the closing brace on the last line
29
33
  Layout/MultilineMethodCallBraceLayout:
30
34
  EnforcedStyle: same_line
@@ -55,10 +59,6 @@ Metrics/BlockLength:
55
59
  Exclude:
56
60
  - 'spec/**/*'
57
61
 
58
- # Be rather lenient with line length
59
- Metrics/LineLength:
60
- Max: 120
61
-
62
62
  # Keyword arguments make long parameter lists readable
63
63
  Metrics/ParameterLists:
64
64
  CountKeywordArgs: false
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-11-04 12:41:28 +0100 using RuboCop version 0.60.0.
3
+ # on 2019-12-22 13:19:30 +0100 using RuboCop version 0.78.0.
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
@@ -15,7 +15,7 @@ Metrics/AbcSize:
15
15
  Metrics/ClassLength:
16
16
  Max: 161
17
17
 
18
- # Offense count: 13
18
+ # Offense count: 14
19
19
  # Configuration parameters: CountComments, ExcludedMethods.
20
20
  Metrics/MethodLength:
21
21
  Max: 16
@@ -55,8 +55,8 @@ RSpec/NestedGroups:
55
55
 
56
56
  # Offense count: 2
57
57
  # Cop supports --auto-correct.
58
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
59
- # Whitelist: present?, blank?, presence, try, try!
58
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
59
+ # AllowedMethods: present?, blank?, presence, try, try!
60
60
  Style/SafeNavigation:
61
61
  Exclude:
62
62
  - 'lib/reek/ast/node.rb'
@@ -12,6 +12,7 @@ rvm:
12
12
  - 2.4
13
13
  - 2.5
14
14
  - 2.6
15
+ - 2.7
15
16
  - jruby-9.1.17.0
16
17
  - jruby-9.2.6.0
17
18
  - jruby-head
@@ -1,5 +1,10 @@
1
1
  # Change log
2
2
 
3
+ ## 5.6.0 (2020-01-20)
4
+
5
+ * (mvz) Support Ruby 2.7
6
+ * (mvz) Loosen parser dependency to allow version 2.7.x
7
+
3
8
  ## 5.5.0 (2019-11-13)
4
9
 
5
10
  * (mvz) Use the Parser class matching current ruby for parsing, instead of
data/Gemfile CHANGED
@@ -13,9 +13,9 @@ group :development do
13
13
  gem 'rake', '~> 13.0'
14
14
  gem 'rspec', '~> 3.0'
15
15
  gem 'rspec-benchmark', '~> 0.5.0'
16
- gem 'rubocop', '~> 0.75.0'
16
+ gem 'rubocop', '~> 0.79.0'
17
17
  gem 'rubocop-performance', '~> 1.5.0'
18
- gem 'rubocop-rspec', '~> 1.36.0'
18
+ gem 'rubocop-rspec', '~> 1.37.0'
19
19
  gem 'simplecov', '~> 0.17.0'
20
20
  gem 'yard', '~> 0.9.5'
21
21
 
@@ -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/v5.5.0/docs/Code-Smells.md for a list of smells
46
+ Check out https://github.com/troessner/reek/blob/v5.6.0/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:
@@ -120,5 +120,5 @@ Feature: Reek can be controlled using command-line options
120
120
  UnusedPrivateMethod
121
121
  UtilityFunction
122
122
 
123
- Check out https://github.com/troessner/reek/blob/v5.5.0/docs/Code-Smells.md for a details on each detector
123
+ Check out https://github.com/troessner/reek/blob/v5.6.0/docs/Code-Smells.md for a details on each detector
124
124
  """
@@ -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/v5.5.0/docs/Uncommunicative-Method-Name.md",
27
+ "documentation_link": "https://github.com/troessner/reek/blob/v5.6.0/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/v5.5.0/docs/Uncommunicative-Variable-Name.md",
36
+ "documentation_link": "https://github.com/troessner/reek/blob/v5.6.0/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/v5.5.0/docs/Irresponsible-Module.md"
56
+ "documentation_link": "https://github.com/troessner/reek/blob/v5.6.0/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/v5.5.0/docs/Uncommunicative-Method-Name.md]
186
- [5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v5.5.0/docs/Uncommunicative-Variable-Name.md]
185
+ [4]:UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/v5.6.0/docs/Uncommunicative-Method-Name.md]
186
+ [5]:UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v5.6.0/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/v5.5.0/docs/Uncommunicative-Method-Name.md]
213
- UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v5.5.0/docs/Uncommunicative-Variable-Name.md]
212
+ UncommunicativeMethodName: Smelly#x has the name 'x' [https://github.com/troessner/reek/blob/v5.6.0/docs/Uncommunicative-Method-Name.md]
213
+ UncommunicativeVariableName: Smelly#x has the variable name 'y' [https://github.com/troessner/reek/blob/v5.6.0/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/v5.5.0/docs/Uncommunicative-Method-Name.md
28
+ documentation_link: https://github.com/troessner/reek/blob/v5.6.0/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/v5.5.0/docs/Uncommunicative-Variable-Name.md
36
+ documentation_link: https://github.com/troessner/reek/blob/v5.6.0/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/v5.5.0/docs/Irresponsible-Module.md
51
+ documentation_link: https://github.com/troessner/reek/blob/v5.6.0/docs/Irresponsible-Module.md
52
52
  """
@@ -5,7 +5,7 @@ require 'active_support/core_ext/string/strip'
5
5
 
6
6
  begin
7
7
  require 'pry-byebug'
8
- rescue LoadError # rubocop:disable Lint/HandleExceptions
8
+ rescue LoadError # rubocop:disable Lint/SuppressedException
9
9
  end
10
10
 
11
11
  #
@@ -123,20 +123,20 @@ module Reek
123
123
  def escalate_bad_detector
124
124
  return if SmellDetectors::BaseDetector.valid_detector?(detector_name)
125
125
 
126
- raise Errors::BadDetectorInCommentError, detector_name: detector_name,
127
- original_comment: original_comment,
128
- source: source,
129
- line: line
126
+ raise Errors::BadDetectorInCommentError.new(detector_name: detector_name,
127
+ original_comment: original_comment,
128
+ source: source,
129
+ line: line)
130
130
  end
131
131
 
132
132
  def escalate_bad_detector_configuration
133
133
  @parsed_options = YAML.safe_load(options || CodeComment::DISABLE_DETECTOR_CONFIGURATION,
134
134
  permitted_classes: [Regexp])
135
135
  rescue Psych::SyntaxError
136
- raise Errors::GarbageDetectorConfigurationInCommentError, detector_name: detector_name,
137
- original_comment: original_comment,
138
- source: source,
139
- line: line
136
+ raise Errors::GarbageDetectorConfigurationInCommentError.new(detector_name: detector_name,
137
+ original_comment: original_comment,
138
+ source: source,
139
+ line: line)
140
140
  end
141
141
 
142
142
  def escalate_unknown_configuration_key
@@ -144,11 +144,11 @@ module Reek
144
144
 
145
145
  return if given_keys_legit?
146
146
 
147
- raise Errors::BadDetectorConfigurationKeyInCommentError, detector_name: detector_name,
148
- offensive_keys: configuration_keys_difference,
149
- original_comment: original_comment,
150
- source: source,
151
- line: line
147
+ raise Errors::BadDetectorConfigurationKeyInCommentError.new(detector_name: detector_name,
148
+ offensive_keys: configuration_keys_difference,
149
+ original_comment: original_comment,
150
+ source: source,
151
+ line: line)
152
152
  end
153
153
 
154
154
  # @return [Boolean] all keys in code comment are applicable to the detector in question
@@ -105,11 +105,11 @@ module Reek
105
105
  rescue Errors::BaseError
106
106
  raise
107
107
  rescue EncodingError
108
- raise Errors::EncodingError, origin: origin
108
+ raise Errors::EncodingError.new(origin: origin)
109
109
  rescue Parser::SyntaxError
110
- raise Errors::SyntaxError, origin: origin
110
+ raise Errors::SyntaxError.new(origin: origin)
111
111
  rescue StandardError
112
- raise Errors::IncomprehensibleSourceError, origin: origin
112
+ raise Errors::IncomprehensibleSourceError.new(origin: origin)
113
113
  end
114
114
 
115
115
  def syntax_tree
@@ -11,8 +11,8 @@ module Reek
11
11
  #
12
12
  class TextReport < BaseReport
13
13
  # @public
14
- def initialize(*args)
15
- super(*args)
14
+ def initialize(**args)
15
+ super
16
16
 
17
17
  print progress_formatter.header
18
18
  end
@@ -43,13 +43,9 @@ module Reek
43
43
  end
44
44
 
45
45
  def build_smell_warning(ancestor_name)
46
- smell_attributes = {
47
- lines: [source_line],
48
- message: "inherits from core class '#{ancestor_name}'",
49
- parameters: { ancestor: ancestor_name }
50
- }
51
-
52
- smell_warning(smell_attributes)
46
+ smell_warning(lines: [source_line],
47
+ message: "inherits from core class '#{ancestor_name}'",
48
+ parameters: { ancestor: ancestor_name })
53
49
  end
54
50
  end
55
51
  end
@@ -8,6 +8,6 @@ module Reek
8
8
  # @public
9
9
  module Version
10
10
  # @public
11
- STRING = '5.5.0'
11
+ STRING = '5.6.0'
12
12
  end
13
13
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_runtime_dependency 'codeclimate-engine-rb', '~> 0.4.0'
23
23
  s.add_runtime_dependency 'kwalify', '~> 0.7.0'
24
- s.add_runtime_dependency 'parser', '< 2.7', '>= 2.5.0.0', '!= 2.5.1.1'
24
+ s.add_runtime_dependency 'parser', '< 2.8', '>= 2.5.0.0', '!= 2.5.1.1'
25
25
  s.add_runtime_dependency 'psych', '~> 3.1.0'
26
26
  s.add_runtime_dependency 'rainbow', '>= 2.0', '< 4.0'
27
27
  end
@@ -4,7 +4,7 @@ require_relative '../../lib/reek/smell_warning'
4
4
  require_relative '../../lib/reek/cli/options'
5
5
 
6
6
  FactoryBot.define do
7
- factory :smell_warning, class: Reek::SmellWarning do
7
+ factory :smell_warning, class: 'Reek::SmellWarning' do
8
8
  skip_create
9
9
 
10
10
  smell_type { 'FeatureEnvy' }
@@ -24,7 +24,7 @@ FactoryBot.define do
24
24
  end
25
25
  end
26
26
 
27
- factory :code_comment, class: Reek::CodeComment do
27
+ factory :code_comment, class: 'Reek::CodeComment' do
28
28
  comment { '' }
29
29
  line { 1 }
30
30
  source { 'string' }
@@ -7,7 +7,7 @@ require 'stringio'
7
7
 
8
8
  RSpec.describe Reek::Report::CodeClimateReport do
9
9
  let(:options) { {} }
10
- let(:instance) { described_class.new(options) }
10
+ let(:instance) { described_class.new(**options) }
11
11
  let(:examiner) { Reek::Examiner.new(source) }
12
12
 
13
13
  before do
@@ -7,7 +7,7 @@ require 'stringio'
7
7
 
8
8
  RSpec.describe Reek::Report::JSONReport do
9
9
  let(:options) { {} }
10
- let(:instance) { described_class.new(options) }
10
+ let(:instance) { described_class.new(**options) }
11
11
  let(:examiner) { Reek::Examiner.new(source) }
12
12
 
13
13
  before do
@@ -6,13 +6,7 @@ require_lib 'reek/report/simple_warning_formatter'
6
6
  require 'rainbow'
7
7
 
8
8
  RSpec.describe Reek::Report::TextReport do
9
- let(:report_options) do
10
- {
11
- warning_formatter: Reek::Report::SimpleWarningFormatter.new,
12
- heading_formatter: Reek::Report::QuietHeadingFormatter
13
- }
14
- end
15
- let(:instance) { described_class.new report_options }
9
+ let(:instance) { described_class.new }
16
10
 
17
11
  context 'with a single empty source' do
18
12
  before do
@@ -7,7 +7,7 @@ require 'stringio'
7
7
 
8
8
  RSpec.describe Reek::Report::YAMLReport do
9
9
  let(:options) { {} }
10
- let(:instance) { described_class.new(options) }
10
+ let(:instance) { described_class.new(**options) }
11
11
  let(:examiner) { Reek::Examiner.new(source) }
12
12
 
13
13
  before do
@@ -11,7 +11,7 @@ require_relative '../samples/paths'
11
11
 
12
12
  begin
13
13
  Reek::CLI::Silencer.without_warnings { require 'pry-byebug' }
14
- rescue LoadError # rubocop:disable Lint/HandleExceptions
14
+ rescue LoadError # rubocop:disable Lint/SuppressedException
15
15
  end
16
16
 
17
17
  require 'factory_bot'
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: 5.5.0
4
+ version: 5.6.0
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: 2019-11-13 00:00:00.000000000 Z
14
+ date: 2020-01-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: codeclimate-engine-rb
@@ -45,28 +45,28 @@ dependencies:
45
45
  name: parser
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '2.8'
48
51
  - - ">="
49
52
  - !ruby/object:Gem::Version
50
53
  version: 2.5.0.0
51
54
  - - "!="
52
55
  - !ruby/object:Gem::Version
53
56
  version: 2.5.1.1
54
- - - "<"
55
- - !ruby/object:Gem::Version
56
- version: '2.7'
57
57
  type: :runtime
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
+ - - "<"
62
+ - !ruby/object:Gem::Version
63
+ version: '2.8'
61
64
  - - ">="
62
65
  - !ruby/object:Gem::Version
63
66
  version: 2.5.0.0
64
67
  - - "!="
65
68
  - !ruby/object:Gem::Version
66
69
  version: 2.5.1.1
67
- - - "<"
68
- - !ruby/object:Gem::Version
69
- version: '2.7'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: psych
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -499,7 +499,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
499
499
  - !ruby/object:Gem::Version
500
500
  version: '0'
501
501
  requirements: []
502
- rubygems_version: 3.0.6
502
+ rubygems_version: 3.1.2
503
503
  signing_key:
504
504
  specification_version: 4
505
505
  summary: Code smell detector for Ruby