rubocop-socketry 0.10.0 → 0.11.0
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/block_delimiter_spacing.rb +2 -0
- data/lib/rubocop/socketry/layout/consistent_blank_line_indentation.rb +11 -5
- data/lib/rubocop/socketry/style/global_exception_variables.rb +2 -1
- data/lib/rubocop/socketry/version.rb +1 -1
- data/readme.md +4 -0
- data/releases.md +4 -0
- 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: 6afce664365a0b7fa9a50a48b6aebc9f05b1de2755f8bc133a85b051b0819d79
|
|
4
|
+
data.tar.gz: fb88cb2a6b157b82269bc2afa51cbe08d9327b8d885b4b7baab08180bf2dcd62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a433da1fbc1394419fc20e73c4c3a883b5a18ca58b7e0ff46e070a9f7aee7139e6dee1edda29053c1d2015650714db1aaa3152ae479716ef6269d880191e4dc0
|
|
7
|
+
data.tar.gz: 3aa6a42823410aae0c2b7889915c0857c54efbcb3f83e8a7f07a83cf98014a862ec479f1ba0db7aeb1017bb3b4aabd3197be7a194d6f7a4473723eee5f265300
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -27,6 +27,8 @@ module RuboCop
|
|
|
27
27
|
MSG_REMOVE_SPACE_LAMBDA = "Remove space before the opening brace for lambdas/procs."
|
|
28
28
|
MSG_REMOVE_SPACE_EXPRESSION = "Remove space before the opening brace for expressions."
|
|
29
29
|
|
|
30
|
+
# Check each brace-delimited block for the required spacing before `{`.
|
|
31
|
+
# @parameter node [RuboCop::AST::BlockNode] The block node to inspect.
|
|
30
32
|
def on_block(node)
|
|
31
33
|
return unless node.braces?
|
|
32
34
|
|
|
@@ -49,6 +49,7 @@ module RuboCop
|
|
|
49
49
|
def on_new_investigation
|
|
50
50
|
indentation_deltas = build_indentation_deltas
|
|
51
51
|
current_level = 0
|
|
52
|
+
semantic_level = 0
|
|
52
53
|
|
|
53
54
|
processed_source.lines.each_with_index do |line, index|
|
|
54
55
|
line_number = index + 1
|
|
@@ -75,7 +76,16 @@ module RuboCop
|
|
|
75
76
|
end
|
|
76
77
|
end
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
if delta > 0
|
|
80
|
+
current_level += 1
|
|
81
|
+
semantic_level += delta
|
|
82
|
+
elsif delta < 0
|
|
83
|
+
semantic_level += delta
|
|
84
|
+
current_level = [current_level, semantic_level].min
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
current_level = [current_level, 0].max
|
|
88
|
+
semantic_level = [semantic_level, 0].max
|
|
79
89
|
end
|
|
80
90
|
end
|
|
81
91
|
|
|
@@ -87,10 +97,6 @@ module RuboCop
|
|
|
87
97
|
def build_indentation_deltas
|
|
88
98
|
Hash.new(0).tap do |deltas|
|
|
89
99
|
walk_ast_for_indentation(processed_source.ast, deltas)
|
|
90
|
-
|
|
91
|
-
# Cap deltas to a maximum of +1 or -1 per line to handle cases where
|
|
92
|
-
# multiple structures open/close on the same line (e.g., `[..., {`)
|
|
93
|
-
deltas.transform_values!{|delta| delta.nil? ? nil : delta.clamp(-1, 1)}
|
|
94
100
|
end
|
|
95
101
|
end
|
|
96
102
|
|
|
@@ -66,6 +66,8 @@ module RuboCop
|
|
|
66
66
|
|
|
67
67
|
EXCEPTION_VARIABLES = %i[$! $@ $ERROR_INFO $ERROR_POSITION].freeze
|
|
68
68
|
|
|
69
|
+
# Check each global variable reference for unsafe exception state access.
|
|
70
|
+
# @parameter node [RuboCop::AST::GlobalVariableNode] The global variable node to inspect.
|
|
69
71
|
def on_gvar(node)
|
|
70
72
|
variable_name = node.children.first
|
|
71
73
|
|
|
@@ -122,4 +124,3 @@ module RuboCop
|
|
|
122
124
|
end
|
|
123
125
|
end
|
|
124
126
|
end
|
|
125
|
-
|
data/readme.md
CHANGED
|
@@ -27,6 +27,10 @@ Layout/ConsistentBlankLineIndentation:
|
|
|
27
27
|
|
|
28
28
|
Please see the [project releases](https://socketry.github.io/rubocop-socketry/releases/index) for all releases.
|
|
29
29
|
|
|
30
|
+
### v0.11.0
|
|
31
|
+
|
|
32
|
+
- Fixed `Layout/ConsistentBlankLineIndentation` to preserve semantic indentation depth for same-line nested structures, avoiding negative indentation levels when later closing lines are processed.
|
|
33
|
+
|
|
30
34
|
### v0.10.0
|
|
31
35
|
|
|
32
36
|
- Fixed `Layout/BlockDelimiterSpacing` to correctly treat a block as a statement (requiring space before `{`) when it is the sole body of a multi-line outer block or method/class/module definition. Previously, the absence of a `:begin` wrapper in the AST caused such blocks (e.g. `Async {foo}` or `let(:bar) {baz}` inside a `describe`/`context` block) to be misclassified as expression-context and have their space incorrectly removed.
|
data/releases.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v0.11.0
|
|
4
|
+
|
|
5
|
+
- Fixed `Layout/ConsistentBlankLineIndentation` to preserve semantic indentation depth for same-line nested structures, avoiding negative indentation levels when later closing lines are processed.
|
|
6
|
+
|
|
3
7
|
## v0.10.0
|
|
4
8
|
|
|
5
9
|
- Fixed `Layout/BlockDelimiterSpacing` to correctly treat a block as a statement (requiring space before `{`) when it is the sole body of a multi-line outer block or method/class/module definition. Previously, the absence of a `:begin` wrapper in the AST caused such blocks (e.g. `Async {foo}` or `let(:bar) {baz}` inside a `describe`/`context` block) to be misclassified as expression-context and have their space incorrectly removed.
|
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.
|
|
4
|
+
version: 0.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
103
103
|
- !ruby/object:Gem::Version
|
|
104
104
|
version: '0'
|
|
105
105
|
requirements: []
|
|
106
|
-
rubygems_version: 4.0.
|
|
106
|
+
rubygems_version: 4.0.10
|
|
107
107
|
specification_version: 4
|
|
108
108
|
summary: RuboCop rules for Socketry projects
|
|
109
109
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|