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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3bdf0fc2d1db810ae5d2bb5d15895f763062e83a4cff437e17f9707b4f9f7d27
4
- data.tar.gz: f615231a3fa949865a21623f160195da22ad401e2198db990a5ebffa9554dea4
3
+ metadata.gz: 0dacbb6af420eedc76cec483085c0bac470416faf318a2ddaee52980c3a43f59
4
+ data.tar.gz: 4f128fdca62a037f273ee0ab534446e08df7b97bd578b6ca50f287f3f63e8d43
5
5
  SHA512:
6
- metadata.gz: aa0b76dd902e2bbfc9409a54c242b15912cc850c9c2a3f26618adedc5a6275eb0d2c690eb224b23f0fbe620e777f2f0efbf0c58a3d7c2d7e324e233323e736d7
7
- data.tar.gz: 40c8ad00c40ee7619c6f3f9ccf3e22bd5a4a71c1920683c326a21a80cd90620bb4f34acaeabe469c01991e4ee304e38aed89381fb05a2a7b66652e50bee9a0ff
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
- # and should have space. Everything else (expressions, nested blocks) should not.
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
- # Otherwise, it's part of an expression or nested context
91
- parent.type != :begin
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
@@ -1,10 +1,10 @@
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
  module RuboCop
7
7
  module Socketry
8
- VERSION = "0.7.0"
8
+ VERSION = "0.8.0"
9
9
  end
10
10
  end
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2025, by Samuel Williams.
3
+ Copyright, 2025-2026, by Samuel Williams.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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
@@ -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.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file