rubocop-socketry 0.7.0 → 0.9.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: bcb70c0ac2421d12d0a38c1e28338e67b3d57e1bef6d9d0121a00c6d042953d5
4
+ data.tar.gz: f6754cbd98784332753e86c9fc5261ba8214708f94c4d7ca2e7783f21520c956
5
5
  SHA512:
6
- metadata.gz: aa0b76dd902e2bbfc9409a54c242b15912cc850c9c2a3f26618adedc5a6275eb0d2c690eb224b23f0fbe620e777f2f0efbf0c58a3d7c2d7e324e233323e736d7
7
- data.tar.gz: 40c8ad00c40ee7619c6f3f9ccf3e22bd5a4a71c1920683c326a21a80cd90620bb4f34acaeabe469c01991e4ee304e38aed89381fb05a2a7b66652e50bee9a0ff
6
+ metadata.gz: 696a82e7609dc56b42bb91bbd4a13d998c1bc64f65e227fc63dcba97e0f15740e883007e1766cc9b30e36ad30fca6e74b03d3aca10c0f23fce47dd87c9b1062a
7
+ data.tar.gz: 60e83ca55460e2af2dac385563f139edb7fbe4e0fc2b0b7de82c0110ca06c4360d6b4c639278a09f64be313ccfe4c442a3ecc4a7e024923e86487967ce5fc15a
checksums.yaml.gz.sig CHANGED
Binary file
@@ -61,6 +61,7 @@ module RuboCop
61
61
  # Check blank lines for correct indentation:
62
62
  if line.strip.empty?
63
63
  expected_indentation = indentation(current_level)
64
+
64
65
  if line != expected_indentation
65
66
  add_offense(
66
67
  source_range(processed_source.buffer, line_number, 0, line.length),
@@ -84,9 +85,13 @@ module RuboCop
84
85
  # This method walks the AST to identify where indentation should increase or decrease.
85
86
  # @returns [Hash(Integer, Integer)] A hash where keys are line numbers and values are deltas.
86
87
  def build_indentation_deltas
87
- deltas = Hash.new(0)
88
- walk_ast_for_indentation(processed_source.ast, deltas)
89
- deltas
88
+ Hash.new(0).tap do |deltas|
89
+ 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
+ end
90
95
  end
91
96
 
92
97
  STRUCTURAL_NODES = [:array, :hash, :class, :module, :sclass, :def, :defs, :if, :if, :while, :until, :for, :case, :kwbegin, :regexp]
@@ -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.9.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.9.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.3
106
+ rubygems_version: 4.0.6
107
107
  specification_version: 4
108
108
  summary: RuboCop rules for Socketry projects
109
109
  test_files: []
metadata.gz.sig CHANGED
Binary file