rubocop-socketry 0.7.0 → 0.8.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 +18 -4
- data/lib/rubocop/socketry/version.rb +2 -2
- data/license.md +1 -1
- data/readme.md +20 -0
- data/releases.md +20 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: 0dacbb6af420eedc76cec483085c0bac470416faf318a2ddaee52980c3a43f59
|
|
4
|
+
data.tar.gz: 4f128fdca62a037f273ee0ab534446e08df7b97bd578b6ca50f287f3f63e8d43
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b87895050fdfd00301e6f3f33bd742f87f6ffcc46963f33f33df285e7f8d3e9079b24fb6be8aee2352c697df1d36d7fddf9cca90e9453da047b3fad2cd5208ab
|
|
7
|
+
data.tar.gz: 0b21c56b058e9a97716e37846c52238afb798d5b584f6920820706aa93e11b41a5f1e5258b5171d7842c943916d9b93b53b9674e4c4a0f1e9fd016f2d7ba9839
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
|
-
# Copyright, 2025, by Samuel Williams.
|
|
4
|
+
# Copyright, 2025-2026, by Samuel Williams.
|
|
5
5
|
|
|
6
6
|
require "rubocop"
|
|
7
7
|
|
|
@@ -81,14 +81,28 @@ module RuboCop
|
|
|
81
81
|
|
|
82
82
|
# Check if the block is part of an expression (not a top-level statement)
|
|
83
83
|
# Top-level statements are directly inside a :begin node (file/method body)
|
|
84
|
-
#
|
|
84
|
+
# or inside do...end block bodies, and should have space.
|
|
85
|
+
# Everything else (expressions, nested arguments, etc.) should not have space.
|
|
85
86
|
def part_of_expression?(node)
|
|
86
87
|
parent = node.parent
|
|
87
88
|
return false unless parent
|
|
88
89
|
|
|
89
90
|
# If parent is a :begin node (sequence of statements), this is top-level
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
return false if parent.type == :begin
|
|
92
|
+
|
|
93
|
+
# If parent is a :block node, check if it's a do...end block
|
|
94
|
+
# do...end blocks contain statements (no space)
|
|
95
|
+
# {...} blocks contain expressions (space required)
|
|
96
|
+
if parent.type == :block
|
|
97
|
+
# do...end blocks use keywords, {...} blocks use braces
|
|
98
|
+
return false unless parent.braces?
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Check if we're in a :kwbegin node (begin...end block body)
|
|
102
|
+
return false if parent.type == :kwbegin
|
|
103
|
+
|
|
104
|
+
# Otherwise, it's part of an expression (assignment, argument, etc.)
|
|
105
|
+
true
|
|
92
106
|
end
|
|
93
107
|
|
|
94
108
|
# Check that there's no space before the opening brace for lambdas
|
data/license.md
CHANGED
data/readme.md
CHANGED
|
@@ -27,6 +27,26 @@ 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.8.0
|
|
31
|
+
|
|
32
|
+
- Fixed `Layout/BlockDelimiterSpacing` to correctly distinguish between statement and expression contexts for blocks inside `do...end` blocks.
|
|
33
|
+
|
|
34
|
+
### v0.7.0
|
|
35
|
+
|
|
36
|
+
- Fixed `Layout/BlockDelimiterSpacing` to correctly handle blocks inside `do...end` blocks (statements should have space before braces).
|
|
37
|
+
|
|
38
|
+
### v0.6.1
|
|
39
|
+
|
|
40
|
+
- Refined `Style/GlobalExceptionVariables` to allow global exception variables in safe contexts:
|
|
41
|
+
- Inside rescue blocks (well-defined scope).
|
|
42
|
+
- In rescue modifiers (`expression rescue $!`).
|
|
43
|
+
- In method parameter defaults (`def foo(error = $!)`).
|
|
44
|
+
- Added specific warning for using global exception variables in ensure blocks (extremely unsafe).
|
|
45
|
+
|
|
46
|
+
### v0.6.0
|
|
47
|
+
|
|
48
|
+
- Extended `Layout/BlockDelimiterSpacing` to handle lambda and proc constructs (`->`, `lambda`, `proc`, `Proc.new`).
|
|
49
|
+
|
|
30
50
|
### v0.5.0
|
|
31
51
|
|
|
32
52
|
- Added `Style/GlobalExceptionVariables` cop to warn against using global exception variables (`$!`, `$@`, `$ERROR_INFO`, `$ERROR_POSITION`).
|
data/releases.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v0.8.0
|
|
4
|
+
|
|
5
|
+
- Fixed `Layout/BlockDelimiterSpacing` to correctly distinguish between statement and expression contexts for blocks inside `do...end` blocks.
|
|
6
|
+
|
|
7
|
+
## v0.7.0
|
|
8
|
+
|
|
9
|
+
- Fixed `Layout/BlockDelimiterSpacing` to correctly handle blocks inside `do...end` blocks (statements should have space before braces).
|
|
10
|
+
|
|
11
|
+
## v0.6.1
|
|
12
|
+
|
|
13
|
+
- Refined `Style/GlobalExceptionVariables` to allow global exception variables in safe contexts:
|
|
14
|
+
- Inside rescue blocks (well-defined scope).
|
|
15
|
+
- In rescue modifiers (`expression rescue $!`).
|
|
16
|
+
- In method parameter defaults (`def foo(error = $!)`).
|
|
17
|
+
- Added specific warning for using global exception variables in ensure blocks (extremely unsafe).
|
|
18
|
+
|
|
19
|
+
## v0.6.0
|
|
20
|
+
|
|
21
|
+
- Extended `Layout/BlockDelimiterSpacing` to handle lambda and proc constructs (`->`, `lambda`, `proc`, `Proc.new`).
|
|
22
|
+
|
|
3
23
|
## v0.5.0
|
|
4
24
|
|
|
5
25
|
- Added `Style/GlobalExceptionVariables` cop to warn against using global exception variables (`$!`, `$@`, `$ERROR_INFO`, `$ERROR_POSITION`).
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|