rubocop 1.50.1 → 1.50.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +2 -0
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +1 -1
- data/lib/rubocop/cop/layout/first_array_element_line_break.rb +25 -34
- data/lib/rubocop/cop/layout/first_hash_element_line_break.rb +7 -19
- data/lib/rubocop/cop/layout/first_method_argument_line_break.rb +42 -52
- data/lib/rubocop/cop/layout/first_method_parameter_line_break.rb +38 -55
- data/lib/rubocop/cop/layout/multiline_array_line_breaks.rb +8 -27
- data/lib/rubocop/cop/layout/multiline_hash_key_line_breaks.rb +7 -26
- data/lib/rubocop/cop/layout/multiline_method_argument_line_breaks.rb +4 -21
- data/lib/rubocop/cop/layout/multiline_method_parameter_line_breaks.rb +6 -30
- data/lib/rubocop/cop/lint/duplicate_match_pattern.rb +1 -1
- data/lib/rubocop/cop/style/collection_compact.rb +3 -0
- data/lib/rubocop/cop/style/redundant_fetch_block.rb +6 -4
- data/lib/rubocop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67accbc10c4c2ae80033ab2a3713fce8a190d772234cbd52c5584e5c69895915
|
4
|
+
data.tar.gz: 69e7f99ee66c192619b2dc26df6d0ac73c794bb088bade8182f3eceb1cb8d8c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21005d0d16a207a998640686ee7dcf251683899ab8e746baa861888fd26f2e58791733b48869a085b1b365ce2b67e64b216b4cfe6c1a2e26a2ecc699da0ea085
|
7
|
+
data.tar.gz: 461a588bb95269c194efee4ee8570c166ce009695664aa31181f1f0806220f451e4685d4feff8751d4135f196d3cb42ec100c171b905526e06ed968cd9bb47f9
|
data/config/default.yml
CHANGED
@@ -4067,7 +4067,9 @@ Style/InverseMethods:
|
|
4067
4067
|
Style/InvertibleUnlessCondition:
|
4068
4068
|
Description: 'Favor `if` with inverted condition over `unless`.'
|
4069
4069
|
Enabled: false
|
4070
|
+
Safe: false
|
4070
4071
|
VersionAdded: '1.44'
|
4072
|
+
VersionChanged: '1.50'
|
4071
4073
|
# `InverseMethods` are methods that can be inverted in a `unless` condition.
|
4072
4074
|
# The relationship of inverse methods needs to be defined in both directions.
|
4073
4075
|
# Keys and values both need to be defined as symbols.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
5
|
module Gemspec
|
6
|
-
# Checks that deprecated
|
6
|
+
# Checks that deprecated attributes are not set in a gemspec file.
|
7
7
|
# Removing deprecated attributes allows the user to receive smaller packed gems.
|
8
8
|
#
|
9
9
|
# @example
|
@@ -6,49 +6,40 @@ module RuboCop
|
|
6
6
|
# Checks for a line break before the first element in a
|
7
7
|
# multi-line array.
|
8
8
|
#
|
9
|
-
# @example
|
9
|
+
# @example
|
10
10
|
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
11
|
+
# # bad
|
12
|
+
# [ :a,
|
13
|
+
# :b]
|
14
14
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
15
|
+
# # good
|
16
|
+
# [
|
17
|
+
# :a,
|
18
|
+
# :b]
|
19
19
|
#
|
20
|
-
#
|
21
|
-
#
|
20
|
+
# # good
|
21
|
+
# [:a, :b]
|
22
22
|
#
|
23
|
-
#
|
24
|
-
# [
|
25
|
-
# :a,
|
26
|
-
# :b]
|
23
|
+
# @example AllowMultilineFinalElement: false (default)
|
27
24
|
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
# }]
|
25
|
+
# # bad
|
26
|
+
# [ :a, {
|
27
|
+
# :b => :c
|
28
|
+
# }]
|
33
29
|
#
|
34
|
-
#
|
30
|
+
# # good
|
31
|
+
# [
|
32
|
+
# :a, {
|
33
|
+
# :b => :c
|
34
|
+
# }]
|
35
35
|
#
|
36
|
-
#
|
37
|
-
# [ :a,
|
38
|
-
# :b]
|
39
|
-
#
|
40
|
-
# # good
|
41
|
-
# [ :a, {
|
42
|
-
# :b => :c
|
43
|
-
# }]
|
36
|
+
# @example AllowMultilineFinalElement: true
|
44
37
|
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
38
|
+
# # good
|
39
|
+
# [:a, {
|
40
|
+
# :b => :c
|
41
|
+
# }]
|
49
42
|
#
|
50
|
-
# # good
|
51
|
-
# [:a, :b]
|
52
43
|
class FirstArrayElementLineBreak < Base
|
53
44
|
include FirstElementLineBreak
|
54
45
|
extend AutoCorrector
|
@@ -6,17 +6,12 @@ module RuboCop
|
|
6
6
|
# Checks for a line break before the first element in a
|
7
7
|
# multi-line hash.
|
8
8
|
#
|
9
|
-
# @example
|
9
|
+
# @example
|
10
10
|
#
|
11
11
|
# # bad
|
12
12
|
# { a: 1,
|
13
13
|
# b: 2}
|
14
14
|
#
|
15
|
-
# # bad
|
16
|
-
# { a: 1, b: {
|
17
|
-
# c: 3
|
18
|
-
# }}
|
19
|
-
#
|
20
15
|
# # good
|
21
16
|
# {
|
22
17
|
# a: 1,
|
@@ -28,11 +23,14 @@ module RuboCop
|
|
28
23
|
# c: 3
|
29
24
|
# }}
|
30
25
|
#
|
31
|
-
# @example AllowMultilineFinalElement:
|
26
|
+
# @example AllowMultilineFinalElement: false (default)
|
32
27
|
#
|
33
28
|
# # bad
|
34
|
-
# { a: 1,
|
35
|
-
#
|
29
|
+
# { a: 1, b: {
|
30
|
+
# c: 3
|
31
|
+
# }}
|
32
|
+
#
|
33
|
+
# @example AllowMultilineFinalElement: true
|
36
34
|
#
|
37
35
|
# # bad
|
38
36
|
# { a: 1,
|
@@ -45,16 +43,6 @@ module RuboCop
|
|
45
43
|
# c: 3
|
46
44
|
# }}
|
47
45
|
#
|
48
|
-
# # good
|
49
|
-
# {
|
50
|
-
# a: 1,
|
51
|
-
# b: 2 }
|
52
|
-
#
|
53
|
-
# # good
|
54
|
-
# {
|
55
|
-
# a: 1, b: {
|
56
|
-
# c: 3
|
57
|
-
# }}
|
58
46
|
class FirstHashElementLineBreak < Base
|
59
47
|
include FirstElementLineBreak
|
60
48
|
extend AutoCorrector
|
@@ -6,73 +6,63 @@ module RuboCop
|
|
6
6
|
# Checks for a line break before the first argument in a
|
7
7
|
# multi-line method call.
|
8
8
|
#
|
9
|
-
# @example
|
10
|
-
#
|
11
|
-
# # bad
|
12
|
-
# method(foo, bar,
|
13
|
-
# baz)
|
14
|
-
#
|
15
|
-
# # bad
|
16
|
-
# method(foo, bar, {
|
17
|
-
# baz: "a",
|
18
|
-
# qux: "b",
|
19
|
-
# })
|
9
|
+
# @example
|
20
10
|
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
# baz)
|
11
|
+
# # bad
|
12
|
+
# method(foo, bar,
|
13
|
+
# baz)
|
25
14
|
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
30
|
-
# qux: "b",
|
31
|
-
# })
|
15
|
+
# # good
|
16
|
+
# method(
|
17
|
+
# foo, bar,
|
18
|
+
# baz)
|
32
19
|
#
|
33
20
|
# # ignored
|
34
21
|
# method foo, bar,
|
35
22
|
# baz
|
36
23
|
#
|
37
|
-
# @example AllowMultilineFinalElement:
|
24
|
+
# @example AllowMultilineFinalElement: false (default)
|
25
|
+
#
|
26
|
+
# # bad
|
27
|
+
# method(foo, bar, {
|
28
|
+
# baz: "a",
|
29
|
+
# qux: "b",
|
30
|
+
# })
|
38
31
|
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
32
|
+
# # good
|
33
|
+
# method(
|
34
|
+
# foo, bar, {
|
35
|
+
# baz: "a",
|
36
|
+
# qux: "b",
|
37
|
+
# })
|
42
38
|
#
|
43
|
-
#
|
44
|
-
# method(foo,
|
45
|
-
# bar,
|
46
|
-
# {
|
47
|
-
# baz: "a",
|
48
|
-
# qux: "b",
|
49
|
-
# }
|
50
|
-
# )
|
39
|
+
# @example AllowMultilineFinalElement: true
|
51
40
|
#
|
52
|
-
#
|
53
|
-
#
|
41
|
+
# # bad
|
42
|
+
# method(foo,
|
43
|
+
# bar,
|
44
|
+
# {
|
54
45
|
# baz: "a",
|
55
46
|
# qux: "b",
|
56
|
-
# }
|
47
|
+
# }
|
48
|
+
# )
|
57
49
|
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
50
|
+
# # good
|
51
|
+
# method(foo, bar, {
|
52
|
+
# baz: "a",
|
53
|
+
# qux: "b",
|
54
|
+
# })
|
62
55
|
#
|
63
|
-
#
|
64
|
-
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
56
|
+
# # good
|
57
|
+
# method(
|
58
|
+
# foo,
|
59
|
+
# bar,
|
60
|
+
# {
|
61
|
+
# baz: "a",
|
62
|
+
# qux: "b",
|
63
|
+
# }
|
64
|
+
# )
|
72
65
|
#
|
73
|
-
# # ignored
|
74
|
-
# method foo, bar,
|
75
|
-
# baz
|
76
66
|
class FirstMethodArgumentLineBreak < Base
|
77
67
|
include FirstElementLineBreak
|
78
68
|
extend AutoCorrector
|
@@ -6,69 +6,52 @@ module RuboCop
|
|
6
6
|
# Checks for a line break before the first parameter in a
|
7
7
|
# multi-line method parameter definition.
|
8
8
|
#
|
9
|
-
# @example
|
10
|
-
#
|
11
|
-
# # bad
|
12
|
-
# def method(foo, bar,
|
13
|
-
# baz)
|
14
|
-
# do_something
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# # bad
|
18
|
-
# def method(foo, bar, baz = {
|
19
|
-
# :a => "b",
|
20
|
-
# })
|
21
|
-
# do_something
|
22
|
-
# end
|
9
|
+
# @example
|
23
10
|
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
# end
|
11
|
+
# # bad
|
12
|
+
# def method(foo, bar,
|
13
|
+
# baz)
|
14
|
+
# do_something
|
15
|
+
# end
|
30
16
|
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
# foo, bar,
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
# end
|
17
|
+
# # good
|
18
|
+
# def method(
|
19
|
+
# foo, bar,
|
20
|
+
# baz)
|
21
|
+
# do_something
|
22
|
+
# end
|
38
23
|
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
24
|
+
# # ignored
|
25
|
+
# def method foo,
|
26
|
+
# bar
|
27
|
+
# do_something
|
28
|
+
# end
|
44
29
|
#
|
45
|
-
# @example AllowMultilineFinalElement:
|
30
|
+
# @example AllowMultilineFinalElement: false (default)
|
46
31
|
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
32
|
+
# # bad
|
33
|
+
# def method(foo, bar, baz = {
|
34
|
+
# :a => "b",
|
35
|
+
# })
|
36
|
+
# do_something
|
37
|
+
# end
|
52
38
|
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
39
|
+
# # good
|
40
|
+
# def method(
|
41
|
+
# foo, bar, baz = {
|
42
|
+
# :a => "b",
|
43
|
+
# })
|
44
|
+
# do_something
|
45
|
+
# end
|
59
46
|
#
|
60
|
-
#
|
61
|
-
# def method(
|
62
|
-
# foo, bar,
|
63
|
-
# baz)
|
64
|
-
# do_something
|
65
|
-
# end
|
47
|
+
# @example AllowMultilineFinalElement: true
|
66
48
|
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
49
|
+
# # good
|
50
|
+
# def method(foo, bar, baz = {
|
51
|
+
# :a => "b",
|
52
|
+
# })
|
53
|
+
# do_something
|
54
|
+
# end
|
72
55
|
#
|
73
56
|
class FirstMethodParameterLineBreak < Base
|
74
57
|
include FirstElementLineBreak
|
@@ -6,7 +6,7 @@ module RuboCop
|
|
6
6
|
# Ensures that each item in a multi-line array
|
7
7
|
# starts on a separate line.
|
8
8
|
#
|
9
|
-
# @example
|
9
|
+
# @example
|
10
10
|
#
|
11
11
|
# # bad
|
12
12
|
# [
|
@@ -14,11 +14,6 @@ module RuboCop
|
|
14
14
|
# c
|
15
15
|
# ]
|
16
16
|
#
|
17
|
-
# # bad
|
18
|
-
# [ a, b, foo(
|
19
|
-
# bar
|
20
|
-
# )]
|
21
|
-
#
|
22
17
|
# # good
|
23
18
|
# [
|
24
19
|
# a,
|
@@ -35,34 +30,20 @@ module RuboCop
|
|
35
30
|
# )
|
36
31
|
# ]
|
37
32
|
#
|
38
|
-
# @example AllowMultilineFinalElement:
|
33
|
+
# @example AllowMultilineFinalElement: false (default)
|
39
34
|
#
|
40
35
|
# # bad
|
41
|
-
# [
|
42
|
-
# a, b,
|
43
|
-
# c
|
44
|
-
# ]
|
45
|
-
#
|
46
|
-
# # good
|
47
|
-
# [ a, b, foo(
|
36
|
+
# [a, b, foo(
|
48
37
|
# bar
|
49
38
|
# )]
|
50
39
|
#
|
51
|
-
#
|
52
|
-
# [
|
53
|
-
# a,
|
54
|
-
# b,
|
55
|
-
# c
|
56
|
-
# ]
|
40
|
+
# @example AllowMultilineFinalElement: true
|
57
41
|
#
|
58
42
|
# # good
|
59
|
-
# [
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# bar
|
64
|
-
# )
|
65
|
-
# ]
|
43
|
+
# [a, b, foo(
|
44
|
+
# bar
|
45
|
+
# )]
|
46
|
+
#
|
66
47
|
class MultilineArrayLineBreaks < Base
|
67
48
|
include MultilineElementLineBreaks
|
68
49
|
extend AutoCorrector
|
@@ -6,7 +6,7 @@ module RuboCop
|
|
6
6
|
# Ensures that each key in a multi-line hash
|
7
7
|
# starts on a separate line.
|
8
8
|
#
|
9
|
-
# @example
|
9
|
+
# @example
|
10
10
|
#
|
11
11
|
# # bad
|
12
12
|
# {
|
@@ -14,11 +14,6 @@ module RuboCop
|
|
14
14
|
# c: 3
|
15
15
|
# }
|
16
16
|
#
|
17
|
-
# # bad
|
18
|
-
# { a: 1, b: {
|
19
|
-
# c: 3,
|
20
|
-
# }}
|
21
|
-
#
|
22
17
|
# # good
|
23
18
|
# {
|
24
19
|
# a: 1,
|
@@ -34,34 +29,20 @@ module RuboCop
|
|
34
29
|
# }
|
35
30
|
# }
|
36
31
|
#
|
37
|
-
# @example AllowMultilineFinalElement:
|
32
|
+
# @example AllowMultilineFinalElement: false (default)
|
38
33
|
#
|
39
34
|
# # bad
|
40
|
-
# {
|
41
|
-
# a: 1, b: 2,
|
42
|
-
# c: 3
|
43
|
-
# }
|
44
|
-
#
|
45
|
-
# # good
|
46
35
|
# { a: 1, b: {
|
47
36
|
# c: 3,
|
48
37
|
# }}
|
49
38
|
#
|
50
|
-
#
|
51
|
-
# {
|
52
|
-
# a: 1,
|
53
|
-
# b: 2,
|
54
|
-
# c: 3
|
55
|
-
# }
|
56
|
-
#
|
39
|
+
# @example AllowMultilineFinalElement: true
|
57
40
|
#
|
58
41
|
# # good
|
59
|
-
# {
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# }
|
64
|
-
# }
|
42
|
+
# { a: 1, b: {
|
43
|
+
# c: 3,
|
44
|
+
# }}
|
45
|
+
#
|
65
46
|
class MultilineHashKeyLineBreaks < Base
|
66
47
|
include MultilineElementLineBreaks
|
67
48
|
extend AutoCorrector
|
@@ -9,7 +9,7 @@ module RuboCop
|
|
9
9
|
# NOTE: This cop does not move the first argument, if you want that to
|
10
10
|
# be on a separate line, see `Layout/FirstMethodArgumentLineBreak`.
|
11
11
|
#
|
12
|
-
# @example
|
12
|
+
# @example
|
13
13
|
#
|
14
14
|
# # bad
|
15
15
|
# foo(a, b,
|
@@ -31,6 +31,8 @@ module RuboCop
|
|
31
31
|
# # good
|
32
32
|
# foo(a, b, c)
|
33
33
|
#
|
34
|
+
# @example AllowMultilineFinalElement: false (default)
|
35
|
+
#
|
34
36
|
# # good
|
35
37
|
# foo(
|
36
38
|
# a,
|
@@ -42,26 +44,6 @@ module RuboCop
|
|
42
44
|
#
|
43
45
|
# @example AllowMultilineFinalElement: true
|
44
46
|
#
|
45
|
-
# # bad
|
46
|
-
# foo(a, b,
|
47
|
-
# c
|
48
|
-
# )
|
49
|
-
#
|
50
|
-
# # good
|
51
|
-
# foo(a, b, {
|
52
|
-
# foo: "bar",
|
53
|
-
# })
|
54
|
-
#
|
55
|
-
# # good
|
56
|
-
# foo(
|
57
|
-
# a,
|
58
|
-
# b,
|
59
|
-
# c
|
60
|
-
# )
|
61
|
-
#
|
62
|
-
# # good
|
63
|
-
# foo(a, b, c)
|
64
|
-
#
|
65
47
|
# # good
|
66
48
|
# foo(
|
67
49
|
# a,
|
@@ -70,6 +52,7 @@ module RuboCop
|
|
70
52
|
# foo: "bar",
|
71
53
|
# }
|
72
54
|
# )
|
55
|
+
#
|
73
56
|
class MultilineMethodArgumentLineBreaks < Base
|
74
57
|
include MultilineElementLineBreaks
|
75
58
|
extend AutoCorrector
|
@@ -9,7 +9,7 @@ module RuboCop
|
|
9
9
|
# NOTE: This cop does not move the first argument, if you want that to
|
10
10
|
# be on a separate line, see `Layout/FirstMethodParameterLineBreak`.
|
11
11
|
#
|
12
|
-
# @example
|
12
|
+
# @example
|
13
13
|
#
|
14
14
|
# # bad
|
15
15
|
# def foo(a, b,
|
@@ -17,12 +17,6 @@ module RuboCop
|
|
17
17
|
# )
|
18
18
|
# end
|
19
19
|
#
|
20
|
-
# # bad
|
21
|
-
# def foo(a, b = {
|
22
|
-
# foo: "bar",
|
23
|
-
# })
|
24
|
-
# end
|
25
|
-
#
|
26
20
|
# # good
|
27
21
|
# def foo(
|
28
22
|
# a,
|
@@ -44,40 +38,22 @@ module RuboCop
|
|
44
38
|
# def foo(a, b, c)
|
45
39
|
# end
|
46
40
|
#
|
47
|
-
# @example AllowMultilineFinalElement:
|
41
|
+
# @example AllowMultilineFinalElement: false (default)
|
48
42
|
#
|
49
43
|
# # bad
|
50
|
-
# def foo(a, b,
|
51
|
-
# c
|
52
|
-
# )
|
53
|
-
# end
|
54
|
-
#
|
55
|
-
# # good
|
56
44
|
# def foo(a, b = {
|
57
45
|
# foo: "bar",
|
58
46
|
# })
|
59
47
|
# end
|
60
48
|
#
|
61
|
-
#
|
62
|
-
# def foo(
|
63
|
-
# a,
|
64
|
-
# b,
|
65
|
-
# c
|
66
|
-
# )
|
67
|
-
# end
|
49
|
+
# @example AllowMultilineFinalElement: true
|
68
50
|
#
|
69
51
|
# # good
|
70
|
-
# def foo(
|
71
|
-
#
|
72
|
-
#
|
73
|
-
# foo: "bar",
|
74
|
-
# }
|
75
|
-
# )
|
52
|
+
# def foo(a, b = {
|
53
|
+
# foo: "bar",
|
54
|
+
# })
|
76
55
|
# end
|
77
56
|
#
|
78
|
-
# # good
|
79
|
-
# def foo(a, b, c)
|
80
|
-
# end
|
81
57
|
class MultilineMethodParameterLineBreaks < Base
|
82
58
|
include MultilineElementLineBreaks
|
83
59
|
extend AutoCorrector
|
@@ -36,11 +36,14 @@ module RuboCop
|
|
36
36
|
class CollectionCompact < Base
|
37
37
|
include RangeHelp
|
38
38
|
extend AutoCorrector
|
39
|
+
extend TargetRubyVersion
|
39
40
|
|
40
41
|
MSG = 'Use `%<good>s` instead of `%<bad>s`.'
|
41
42
|
RESTRICT_ON_SEND = %i[reject reject! select select!].freeze
|
42
43
|
TO_ENUM_METHODS = %i[to_enum lazy].freeze
|
43
44
|
|
45
|
+
minimum_target_ruby_version 2.4
|
46
|
+
|
44
47
|
# @!method reject_method_with_block_pass?(node)
|
45
48
|
def_node_matcher :reject_method_with_block_pass?, <<~PATTERN
|
46
49
|
(send !nil? {:reject :reject!}
|
@@ -3,11 +3,13 @@
|
|
3
3
|
module RuboCop
|
4
4
|
module Cop
|
5
5
|
module Style
|
6
|
-
# Identifies places where `fetch(key) { value }`
|
7
|
-
# can be replaced by `fetch(key, value)`.
|
6
|
+
# Identifies places where `fetch(key) { value }` can be replaced by `fetch(key, value)`.
|
8
7
|
#
|
9
|
-
# In such cases `fetch(key, value)` method is faster
|
10
|
-
#
|
8
|
+
# In such cases `fetch(key, value)` method is faster than `fetch(key) { value }`.
|
9
|
+
#
|
10
|
+
# NOTE: The block string `'value'` in `hash.fetch(:key) { 'value' }` is detected
|
11
|
+
# when frozen string literal magic comment is enabled (i.e. `# frozen_string_literal: true`),
|
12
|
+
# but not when disabled.
|
11
13
|
#
|
12
14
|
# @safety
|
13
15
|
# This cop is unsafe because it cannot be guaranteed that the receiver
|
data/lib/rubocop/version.rb
CHANGED
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: 1.50.
|
4
|
+
version: 1.50.2
|
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: 2023-04-
|
13
|
+
date: 2023-04-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|