rubocop-socketry 0.2.2 → 0.2.3

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: 1cd24ac3f11cf5e4b0fc32f54ca985578963b64ea7ccdf9d148996b75e0df68f
4
- data.tar.gz: 57ca52a7c26e6f4b029b928ad0b6d5cae1dfab8e8c4105ebd084be7fe1a9732b
3
+ metadata.gz: b25ad4b5bdd6aeaf9f0b41a518f8c31db3ead2ab410f837827f2bc92d422954b
4
+ data.tar.gz: b405f44e0c5e435864b035fd24ff5bf56cfa9dc75b7f920b05db906856791f32
5
5
  SHA512:
6
- metadata.gz: '059d5dd3fc0e62510c4966ea018c4ef15d4e8fd54827895441899c47ca38a4d408e9ef39795112f2c913f0af9012172a0339c3ac42de58f1273ca77e4762161a'
7
- data.tar.gz: dd8b19f094ace1a5891d14877331d9eda98e45a08e326b2d1b87e96696987067bd369852d2887a4e4d4a1c63c38f549ed2d4e07899607da04e373ae924682465
6
+ metadata.gz: 9ebc654b95f9ff26fc351afc98a9b2250501b05b3a03e882d27c5a2deb689d986f9619f95f520ea1a1a38c638311b90351b1478339f03d0e14a087180f9dd482
7
+ data.tar.gz: 8a21062e6208ea01b33727343930a50aa7be89d1bf83eaaeb8eb741ac9f4148a46e51b788e0af3360480ca648b2ff012d51d56e9fafcc997bbb336129a8b422f
checksums.yaml.gz.sig CHANGED
Binary file
@@ -89,6 +89,8 @@ module RuboCop
89
89
  deltas
90
90
  end
91
91
 
92
+ STRUCTURAL_NODES = [:array, :hash, :class, :module, :sclass, :def, :defs, :if, :while, :until, :for, :case, :kwbegin]
93
+
92
94
  def receiver_handles_indentation(node)
93
95
  if send_node = node.children.first
94
96
  return false unless send_node.type == :send
@@ -97,12 +99,14 @@ module RuboCop
97
99
  # Only structural node types handle their own indentation.
98
100
  # These are nodes that create indentation contexts (arrays, hashes, classes, etc.)
99
101
  # All other receivers (simple references, method calls, literals) should allow block indentation.
100
- return [:array, :hash, :class, :module, :sclass, :def, :defs, :if, :while, :until, :for, :case, :kwbegin].include?(receiver.type)
102
+ return STRUCTURAL_NODES.include?(receiver.type)
101
103
  end
102
104
  end
103
105
 
104
106
  return false
105
- end # Recursively walk the AST to build indentation deltas for block structures.
107
+ end
108
+
109
+ # Recursively walk the AST to build indentation deltas for block structures.
106
110
  # This method identifies nodes that should affect indentation and records the deltas.
107
111
  # @parameter node [Parser::AST::Node] The current AST node to process.
108
112
  # @parameter deltas [Hash(Integer, Integer)] The deltas hash to populate.
@@ -119,14 +123,9 @@ module RuboCop
119
123
  deltas[location.last_line] -= 1
120
124
  end
121
125
  end
122
- when :array, :hash, :class, :module, :sclass, :def, :defs, :while, :until, :for, :case, :kwbegin
123
- if location = node.location
124
- deltas[location.line] += 1
125
- deltas[location.last_line] -= 1
126
- end
127
126
  when :if
128
127
  # We don't want to add deltas for elsif, because it's handled by the if node:
129
- if node.keyword == "if"
128
+ if node.keyword == "if" || node.keyword == "unless"
130
129
  if location = node.location
131
130
  deltas[location.line] += 1
132
131
  deltas[location.last_line] -= 1
@@ -141,6 +140,11 @@ module RuboCop
141
140
  end
142
141
  end
143
142
  end
143
+ when *STRUCTURAL_NODES
144
+ if location = node.location
145
+ deltas[location.line] += 1
146
+ deltas[location.last_line] -= 1
147
+ end
144
148
  end
145
149
 
146
150
  node.children.each do |child|
@@ -5,6 +5,6 @@
5
5
 
6
6
  module RuboCop
7
7
  module Socketry
8
- VERSION = "0.2.2"
8
+ VERSION = "0.2.3"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-socketry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file