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: f71b8941f86c6189771d5c9bfcc81f4744e9fb821d45d5ba3c93c5a0fd195320
4
- data.tar.gz: 8032dc595911c74d1d4296d0123918c98e60cb273fd4aa0d1654602526363936
3
+ metadata.gz: fb81a1bb8eee5ff7176afc7baff7a7a7bc1dd6d97229ecceb5893e34b9a53343
4
+ data.tar.gz: 37a5a91a8356363fe6ca22c3530e7f8752144ea392dff6ceefdf1459da84f110
5
5
  SHA512:
6
- metadata.gz: f9a13ac68f7eead1d4186767b1fef7c6e8eaae15beb823a1344acb33bc7a969ef4bf3c8b05665e3fc3291b32f749293237539163d7f8eafc13e4a78f346faed7
7
- data.tar.gz: 58be8bafe667d21c2b9be721a6102fe9fabe16ec8b03633d430385366bb37b4b1dabbb73c552d1f5197affe9f5cbc637b3aefa4a30739f27f640d7431ec898a8
6
+ metadata.gz: 6f3bd57248613bf1e433cd09d5da07798d2a2099609d9ebe43af84b66e8c31561e60c5ce588d80c78e0b93fb21a99c1372fe5b510f0cddbf7fdf961c1dfaaeca
7
+ data.tar.gz: cbf22b6ecb8a5aa2f7125b1e9e547a7e5f51635d81a723fa457af3a8566d9873298b03a83bcd1ed56c80d801e60a0103fa8bb7c0a0101a7bb3c4251ba99feee8
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module BrandsInsurance
5
- VERSION = '1.4.0-rc.1'
5
+ VERSION = '1.4.0-rc.2'
6
6
  end
7
7
  end
@@ -4,67 +4,22 @@ module RuboCop
4
4
  module Cop
5
5
  module BrandsInsurance
6
6
  module Layout
7
- class MultilineArrayLineBreaks < Base
8
- include RuboCop::Cop::MultilineElementLineBreaks
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
- check_line_breaks(node, node.children, ignore_last: ignore_last_element?)
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', false) && node.percent_literal?
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-brands_insurance
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0.pre.rc.1
4
+ version: 1.4.0.pre.rc.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance