rubocop 0.58.0 → 0.58.1

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
  SHA1:
3
- metadata.gz: f3841f2f7a2e69362f57238be2722eb4f06bccf8
4
- data.tar.gz: '0193123e23f57b0cea3701b8f59c90c2ea6b0658'
3
+ metadata.gz: 06a6484e8b771039540df8585fe73d34a5662d78
4
+ data.tar.gz: 7a8d03e1b3bcd23bee23abad73c065de9196154c
5
5
  SHA512:
6
- metadata.gz: 59d32b347c6000e8b1b23981d00cde8017bee3870e941fd72482d415de3966c3928c11b566489ba55e22545d8243e82008df7c5ba4c69e788a75c878df2d13dd
7
- data.tar.gz: 85337f25210448131a7bc0be46a654fd71db0590c5269a328208fbb874e82b79647150b09d64a2a1178bd7d322c013642bd1ecb59ba17516c276a1e31461916d
6
+ metadata.gz: a08758ab2ba66634215f70f0a723ec845e2ce0bfb7f6bd0ad833aa4feacaac9b1557a0d98133a6184f1b15e43e83b944b1e75b2ed0607c874f8fec73e70706a9
7
+ data.tar.gz: '090c04fa7ac19c75ade23b97b55473912f707dc164b39e1254a1c6af8bdc50ad16b343a70b1671027b46578d2e60db2d33efedffce73d1b9964089fab4218778'
data/README.md CHANGED
@@ -53,7 +53,7 @@ haven't reached version 1.0 yet). To prevent an unwanted RuboCop update you
53
53
  might want to use a conservative version locking in your `Gemfile`:
54
54
 
55
55
  ```rb
56
- gem 'rubocop', '~> 0.58.0', require: false
56
+ gem 'rubocop', '~> 0.58.1', require: false
57
57
  ```
58
58
 
59
59
  ## Quickstart
@@ -1654,6 +1654,10 @@ Lint/UnusedMethodArgument:
1654
1654
  AllowUnusedKeywordArguments: false
1655
1655
  IgnoreEmptyMethods: true
1656
1656
 
1657
+ Lint/UselessAccessModifier:
1658
+ ContextCreatingMethods: []
1659
+ MethodCreatingMethods: []
1660
+
1657
1661
  Lint/Void:
1658
1662
  CheckForMethodsWithNoSideEffects: false
1659
1663
 
@@ -761,8 +761,6 @@ Lint/UriRegexp:
761
761
  Lint/UselessAccessModifier:
762
762
  Description: 'Checks for useless access modifiers.'
763
763
  Enabled: true
764
- ContextCreatingMethods: []
765
- MethodCreatingMethods: []
766
764
 
767
765
  Lint/UselessAssignment:
768
766
  Description: 'Checks for useless assignment to a local variable.'
@@ -1033,6 +1031,7 @@ Performance/RegexpMatch:
1033
1031
  Description: >-
1034
1032
  Use `match?` instead of `Regexp#match`, `String#match`, `Symbol#match`,
1035
1033
  `Regexp#===`, or `=~` when `MatchData` is not used.
1034
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#regexp-vs-stringmatch-vs-string-vs-stringmatch-code-'
1036
1035
  Enabled: true
1037
1036
 
1038
1037
  Performance/ReverseEach:
@@ -43,10 +43,15 @@ module RuboCop
43
43
  'on the same line as the assignment operator `=`.'.freeze
44
44
 
45
45
  def check_assignment(node, rhs)
46
+ return if node.send_type?
46
47
  return unless rhs
47
48
  return unless supported_types.include?(rhs.type)
48
49
  return if rhs.first_line == rhs.last_line
49
50
 
51
+ check_by_enforced_style(node, rhs)
52
+ end
53
+
54
+ def check_by_enforced_style(node, rhs)
50
55
  case style
51
56
  when :new_line
52
57
  check_new_line_offense(node, rhs)
@@ -37,7 +37,15 @@ module RuboCop
37
37
  end
38
38
 
39
39
  def gem_name(declaration_node)
40
- declaration_node.first_argument.str_content
40
+ gem_node = declaration_node.first_argument
41
+
42
+ find_gem_name(gem_node)
43
+ end
44
+
45
+ def find_gem_name(gem_node)
46
+ return gem_node.str_content if gem_node.str_type?
47
+
48
+ find_gem_name(gem_node.receiver)
41
49
  end
42
50
 
43
51
  def treat_comments_as_separators
@@ -234,8 +234,9 @@ module RuboCop
234
234
  # @param node [RuboCop::AST::SendNode]
235
235
  def add_offense_for_alter_methods(node)
236
236
  # arguments: [{(sym :table)(str "table")} ...]
237
- table_name = node.arguments[0].value
238
- message = format(MSG_FOR_ALTER_METHODS, table: table_name)
237
+ table_node = node.arguments[0]
238
+ return unless table_node.is_a? RuboCop::AST::BasicLiteralNode
239
+ message = format(MSG_FOR_ALTER_METHODS, table: table_node.value)
239
240
  add_offense(node, message: message)
240
241
  end
241
242
 
@@ -254,11 +255,15 @@ module RuboCop
254
255
  # @param new_node [RuboCop::AST::SendNode]
255
256
  def process(new_node)
256
257
  # arguments: [{(sym :table)(str "table")} ...]
257
- table_name = new_node.arguments[0].value.to_s
258
- flush unless @nodes.all? do |node|
259
- node.arguments[0].value.to_s == table_name
258
+ table_node = new_node.arguments[0]
259
+ if table_node.is_a? RuboCop::AST::BasicLiteralNode
260
+ flush unless @nodes.all? do |node|
261
+ node.arguments[0].value.to_s == table_node.value.to_s
262
+ end
263
+ @nodes << new_node
264
+ else
265
+ flush
260
266
  end
261
- @nodes << new_node
262
267
  end
263
268
 
264
269
  def flush
@@ -93,7 +93,8 @@ module RuboCop
93
93
  def args_parenthesized?(node)
94
94
  return false unless node.arguments.one?
95
95
 
96
- node.arguments.first.parenthesized_call?
96
+ first_node = node.arguments.first
97
+ first_node.begin_type? && first_node.parenthesized_call?
97
98
  end
98
99
  end
99
100
  end
@@ -190,10 +190,18 @@ module RuboCop
190
190
  args.one? && args.first.begin_type?
191
191
  end
192
192
 
193
- def_node_matcher :first_argument?, <<-PATTERN
193
+ def first_argument?(node)
194
+ first_send_argument?(node) || first_super_argument?(node)
195
+ end
196
+
197
+ def_node_matcher :first_send_argument?, <<-PATTERN
194
198
  ^(send _ _ equal?(%0) ...)
195
199
  PATTERN
196
200
 
201
+ def_node_matcher :first_super_argument?, <<-PATTERN
202
+ ^(super equal?(%0) ...)
203
+ PATTERN
204
+
197
205
  def call_chain_starts_with_int?(begin_node, send_node)
198
206
  recv = first_part_of_call_chain(send_node)
199
207
  recv && recv.int_type? && (parent = begin_node.parent) &&
@@ -3,7 +3,7 @@
3
3
  module RuboCop
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
- STRING = '0.58.0'.freeze
6
+ STRING = '0.58.1'.freeze
7
7
 
8
8
  MSG = '%<version>s (using Parser %<parser_version>s, running on ' \
9
9
  '%<ruby_engine>s %<ruby_version>s %<ruby_platform>s)'.freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.58.0
4
+ version: 0.58.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2018-07-07 00:00:00.000000000 Z
13
+ date: 2018-07-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jaro_winkler
@@ -47,6 +47,9 @@ dependencies:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '2.5'
50
+ - - "!="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.5.1.1
50
53
  type: :runtime
51
54
  prerelease: false
52
55
  version_requirements: !ruby/object:Gem::Requirement
@@ -54,6 +57,9 @@ dependencies:
54
57
  - - ">="
55
58
  - !ruby/object:Gem::Version
56
59
  version: '2.5'
60
+ - - "!="
61
+ - !ruby/object:Gem::Version
62
+ version: 2.5.1.1
57
63
  - !ruby/object:Gem::Dependency
58
64
  name: powerpack
59
65
  requirement: !ruby/object:Gem::Requirement