You need to sign in or sign up before continuing.
rubocop-brands_insurance 1.4.0.pre.rc.1 → 1.4.0.pre.rc.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb81a1bb8eee5ff7176afc7baff7a7a7bc1dd6d97229ecceb5893e34b9a53343
|
4
|
+
data.tar.gz: 37a5a91a8356363fe6ca22c3530e7f8752144ea392dff6ceefdf1459da84f110
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f3bd57248613bf1e433cd09d5da07798d2a2099609d9ebe43af84b66e8c31561e60c5ce588d80c78e0b93fb21a99c1372fe5b510f0cddbf7fdf961c1dfaaeca
|
7
|
+
data.tar.gz: cbf22b6ecb8a5aa2f7125b1e9e547a7e5f51635d81a723fa457af3a8566d9873298b03a83bcd1ed56c80d801e60a0103fa8bb7c0a0101a7bb3c4251ba99feee8
|
@@ -4,67 +4,22 @@ module RuboCop
|
|
4
4
|
module Cop
|
5
5
|
module BrandsInsurance
|
6
6
|
module Layout
|
7
|
-
class MultilineArrayLineBreaks <
|
8
|
-
|
9
|
-
# extend RuboCop::Cop::AutoCorrector
|
10
|
-
|
11
|
-
# `RuboCop::Cop::AutoCorrector` must be extended but it only has this method returning `true`
|
12
|
-
#
|
13
|
-
# @return [Boolean]
|
14
|
-
#
|
15
|
-
def support_autocorrect?
|
16
|
-
false
|
17
|
-
end
|
18
|
-
|
19
|
-
MESSAGE = 'Each item in a multi-line array must start on a separate line.'
|
20
|
-
# MSG is needed for `check_line_breaks`
|
21
|
-
MSG = MESSAGE
|
22
|
-
|
7
|
+
class MultilineArrayLineBreaks < RuboCop::Cop::Layout::MultilineArrayLineBreaks
|
8
|
+
# @see super
|
23
9
|
def on_array(node)
|
24
10
|
return if allowed_percent_array?(node)
|
25
11
|
|
26
|
-
|
12
|
+
super
|
27
13
|
end
|
28
14
|
|
29
15
|
private
|
30
16
|
|
31
|
-
# Check conig option
|
32
|
-
#
|
33
|
-
# @return [Boolean]
|
34
|
-
#
|
35
|
-
def ignore_last_element?
|
36
|
-
cop_config.fetch('AllowMultilineFinalElement', false)
|
37
|
-
end
|
38
|
-
|
39
17
|
# Check conig option
|
40
18
|
#
|
41
19
|
# @return [Boolean]
|
42
20
|
#
|
43
21
|
def allowed_percent_array?(node)
|
44
|
-
cop_config.fetch('AllowPercentArray',
|
45
|
-
end
|
46
|
-
|
47
|
-
# Copied from rubocop's source
|
48
|
-
def check_line_breaks(_node, children, ignore_last: false)
|
49
|
-
return if all_on_same_line?(children, ignore_last: ignore_last)
|
50
|
-
|
51
|
-
last_seen_line = -1
|
52
|
-
children.each do |child|
|
53
|
-
if last_seen_line >= child.first_line
|
54
|
-
add_offense(child, message: MESSAGE)
|
55
|
-
else
|
56
|
-
last_seen_line = child.last_line
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
# Copied from rubocop's source
|
62
|
-
def all_on_same_line?(nodes, ignore_last: false)
|
63
|
-
return true if nodes.empty?
|
64
|
-
|
65
|
-
return same_line?(nodes.first, nodes.last) if ignore_last
|
66
|
-
|
67
|
-
nodes.first.first_line == nodes.last.last_line
|
22
|
+
cop_config.fetch('AllowPercentArray', true) && node.percent_literal?
|
68
23
|
end
|
69
24
|
end
|
70
25
|
end
|