rubocop-socketry 0.2.0 → 0.2.1
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rubocop/socketry/layout/consistent_blank_line_indentation.rb +24 -4
- data/lib/rubocop/socketry/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7054dc76500e02a8df56ff00b5d847396cf4622119b7eca147f7eec162ec7b93
|
4
|
+
data.tar.gz: 7e50277305f240048445e71e087948c3e1c9f0f7a8c5bd85b8700348c47fa88d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d9906646551e6803b2a57b1f00d7b85c46b09dd6fff0da0daae38ae6ac41213f6c0ba6281bfcc65a8e0234b541833ad33cacc32b7d13e9a04f03a7c3b5e438
|
7
|
+
data.tar.gz: bdc2fb54732ed2ca0af31a0d7a1dcdf0756830198423cdddd3fe2cb57c93a42519c2e3690d821a6062f750d0dcdf88d57e80dc5aea63c0d302ac8b14b5f606fb
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -89,16 +89,36 @@ module RuboCop
|
|
89
89
|
deltas
|
90
90
|
end
|
91
91
|
|
92
|
+
def receiver_handles_indentation(node)
|
93
|
+
if send_node = node.children.first
|
94
|
+
return false unless send_node.type == :send
|
95
|
+
|
96
|
+
if receiver = send_node.children.first
|
97
|
+
return receiver.type != :send
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
return false
|
102
|
+
end
|
103
|
+
|
92
104
|
# Recursively walk the AST to build indentation deltas for block structures.
|
93
105
|
# This method identifies nodes that should affect indentation and records the deltas.
|
94
106
|
# @parameter node [Parser::AST::Node] The current AST node to process.
|
95
107
|
# @parameter deltas [Hash(Integer, Integer)] The deltas hash to populate.
|
96
|
-
|
108
|
+
# @parameter parent [Parser::AST::Node, nil] The parent node for context.
|
109
|
+
def walk_ast_for_indentation(node, deltas, parent = nil)
|
97
110
|
return unless node.is_a?(Parser::AST::Node)
|
98
111
|
|
99
112
|
case node.type
|
100
|
-
when :block
|
101
|
-
|
113
|
+
when :block
|
114
|
+
# For blocks, we need to be careful about method receiver collections
|
115
|
+
if location = node.location
|
116
|
+
unless receiver_handles_indentation(node)
|
117
|
+
deltas[location.line] += 1
|
118
|
+
deltas[location.last_line] -= 1
|
119
|
+
end
|
120
|
+
end
|
121
|
+
when :hash, :array, :class, :module, :sclass, :def, :defs, :case, :while, :until, :for, :kwbegin
|
102
122
|
if location = node.location
|
103
123
|
deltas[location.line] += 1
|
104
124
|
deltas[location.last_line] -= 1
|
@@ -123,7 +143,7 @@ module RuboCop
|
|
123
143
|
end
|
124
144
|
|
125
145
|
node.children.each do |child|
|
126
|
-
walk_ast_for_indentation(child, deltas)
|
146
|
+
walk_ast_for_indentation(child, deltas, node)
|
127
147
|
end
|
128
148
|
end
|
129
149
|
|
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.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
|
-
rubygems_version: 3.6.
|
104
|
+
rubygems_version: 3.6.9
|
105
105
|
specification_version: 4
|
106
106
|
summary: RuboCop rules for Socketry projects
|
107
107
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|