rubocop-fourshark 0.5.0 → 0.6.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: 8f3bb315d43f2566a53923bb26dd2c22024f52f70d85e5cf6e3de77707cd3267
4
- data.tar.gz: b412c10e92d9d9c68b9d291379b87deea8bf06d60e448be493c3800308908604
3
+ metadata.gz: c4b2d2e8d312ae14c7f582304f4b698783d89dcbaaabb97edbdbf8eb8637d782
4
+ data.tar.gz: 2c21cc3d147f2210f38dc5d694b72a3955da359518a037a9270d60c67bf352d3
5
5
  SHA512:
6
- metadata.gz: 2a779bab95e9568e42c16a69982cb0cb6988f7972297a94953c0865c2491741b07c612fbfa16376a4a92b42be3600929efc6156832b49ccf00c48e5baf853f6b
7
- data.tar.gz: c5ff6b67765e40271346cb8cc2cbc6675b49931704289e5a3338670730eb8052bc1c336f3b20c71c30baf2d005528f90bfd2c6e3dafafa4638a11ce26da66c1d
6
+ metadata.gz: c314121bb42e4b79fe8e2ab9f6658c47f44042ef9cc0038bdd62a905ac8bbe986ff26f1ee67521e6d73ea2585ddaf0fd3d393cb2b54d853f16e115985cc769a6
7
+ data.tar.gz: 861c512174a3a30f7ecbe223467f41899ea8a418f631eb3e44c51c35715538a667be755e5e4bd7f87d7370827347fd75958cfb8cac2296c998ba2e4c1a82c058
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [0.6.0] - 2026-08-05
2
+
3
+ ### Added
4
+
5
+ - `Naming/RescuedExceptionsVariableName` configured to `exception` — a rescued exception is no longer bound to a single-letter name
6
+
7
+ ## [0.5.1] - 2026-06-29
8
+
9
+ ### Fixed
10
+
11
+ - `RSpec/Dialect` no longer remaps `subject`/`subject!` to `let`; only `let!` is remapped. The blind identifier rename rewrote value references such as `expect(subject)` into invalid `expect(let)`
12
+
1
13
  ## [0.5.0] - 2026-06-29
2
14
 
3
15
  ### Changed
data/README.md CHANGED
@@ -52,7 +52,7 @@ Activating the plugin auto-loads the gem's `config/default.yml`, which enables e
52
52
 
53
53
  All cops are **enabled by default** the moment the plugin is activated. Cops scoped to a path (models, specs, factories) only run on files matching that path. Each cop's source file under [`lib/rubocop/cop`](lib/rubocop/cop) carries runnable `@example` blocks showing the bad/good shapes.
54
54
 
55
- ### Naming
55
+ ### Cop naming
56
56
 
57
57
  Cop names follow RuboCop's empirical convention — a noun phrase describing the construct or smell, no `Disallow*`/`No*` prefixes — with two deliberate exceptions:
58
58
 
@@ -81,6 +81,12 @@ Where a 4Shark cop supersedes or contradicts a stock cop, `config/default.yml` t
81
81
  |---|---|
82
82
  | `Layout/MultilineStatementSpacing` | Requires a blank line between two consecutive statements when either spans multiple lines, so multi-line statements read as distinct units. |
83
83
 
84
+ ### Naming
85
+
86
+ | Cop | Intent |
87
+ |---|---|
88
+ | `Naming/RescuedExceptionsVariableName` | A rescued exception is bound to `exception` (`_exception` when unread), not the cop's default `e` — 4Shark bans single-letter variables, and this is the one slot where a stock cop demanded one. Stock cop, configured via `PreferredName`; autocorrects. |
89
+
84
90
  ### Rails (models)
85
91
 
86
92
  | Cop | Intent |
data/config/default.yml CHANGED
@@ -14,6 +14,14 @@ Layout/MultilineStatementSpacing:
14
14
  Layout/MultilineMethodCallIndentation:
15
15
  EnforcedStyle: indented
16
16
 
17
+ # Stock cop configured (not a 4Shark cop): name the rescued exception variable
18
+ # `exception`. The cop's default is `e`, and a single-letter variable is banned by
19
+ # the 4Shark naming convention — so the two disagree on every rescue in the
20
+ # codebase. `PreferredName` is the option the cop ships to settle exactly that,
21
+ # and the cop autocorrects, so the rename is mechanical.
22
+ Naming/RescuedExceptionsVariableName:
23
+ PreferredName: exception
24
+
17
25
  Style/DisallowSafeNavigation:
18
26
  Description: 'Do not use safe navigation (`&.`). Use explicit conditionals instead.'
19
27
  Enabled: true
@@ -56,16 +64,15 @@ Rails/OrderedMacros:
56
64
  - 'app/models/**/*.rb'
57
65
  VersionAdded: '0.2.0'
58
66
 
59
- # Stock cop configured (not a 4Shark cop): map `subject`/`subject!`/`let!` to `let`
60
- # so every `subject`, `subject!` and `let!` call is flagged in favor of a lazy
61
- # `let` (force creation in an explicit `before`, not with `let!`). The implicit
62
- # subject behind `is_expected` is a different method and is left untouched.
67
+ # Stock cop configured (not a 4Shark cop): map `let!` to `let` so every eager
68
+ # `let!` call is flagged in favor of a lazy `let` (force creation in an explicit
69
+ # `before`, not with `let!`). `subject`/`subject!` are intentionally NOT remapped:
70
+ # RSpec/Dialect renames the identifier blindly, so a `subject` -> `let` mapping
71
+ # also rewrites value references like `expect(subject)` into invalid `expect(let)`.
63
72
  RSpec/Dialect:
64
- Description: 'Use `let`, never `subject` or `let!` — objects are lazy `let`, forced in `before`.'
73
+ Description: 'Prefer a lazy `let` over `let!` — force creation in an explicit `before`, not with `let!`.'
65
74
  Enabled: true
66
75
  PreferredMethods:
67
- subject: let
68
- subject!: let
69
76
  let!: let
70
77
  Include:
71
78
  - 'spec/**/*_spec.rb'
@@ -58,7 +58,7 @@ module RuboCop
58
58
  add_global_offense("#{target_class} is missing opposite association for #{model_name}")
59
59
  end
60
60
  end
61
- rescue StandardError => e
61
+ rescue StandardError => exception
62
62
  source_name =
63
63
  if processed_source && processed_source.buffer
64
64
  processed_source.file_path
@@ -66,7 +66,7 @@ module RuboCop
66
66
  'unknown'
67
67
  end
68
68
 
69
- warn "Rails/BidirectionalAssociation failed on #{source_name}: #{e.message}"
69
+ warn "Rails/BidirectionalAssociation failed on #{source_name}: #{exception.message}"
70
70
  end
71
71
 
72
72
  private
@@ -41,7 +41,7 @@ module RuboCop
41
41
  !kwargs || !kwargs.hash_type? || kwargs.keys.none? { |k| k.value == :inverse_of }
42
42
 
43
43
  add_offense(node.loc.selector) if missing_inverse_of
44
- rescue StandardError => e
44
+ rescue StandardError => exception
45
45
  source_name =
46
46
  if processed_source && processed_source.buffer
47
47
  processed_source.file_path
@@ -49,7 +49,7 @@ module RuboCop
49
49
  'unknown'
50
50
  end
51
51
 
52
- warn "Rails/MandatoryInverseOf failed on #{source_name}: #{e.message}"
52
+ warn "Rails/MandatoryInverseOf failed on #{source_name}: #{exception.message}"
53
53
  end
54
54
 
55
55
  private
@@ -46,7 +46,7 @@ module RuboCop
46
46
  elsif classification == :subclass
47
47
  add_offense(node.loc.selector, message: MSG_FORBIDDEN_INVERSE) if chain_has_inverse_of?(node)
48
48
  end
49
- rescue StandardError => e
49
+ rescue StandardError => exception
50
50
  source_name =
51
51
  if processed_source && processed_source.buffer
52
52
  processed_source.file_path
@@ -54,7 +54,7 @@ module RuboCop
54
54
  'unknown'
55
55
  end
56
56
 
57
- warn "RSpec/InverseOfMatcher failed on #{source_name}: #{e.message}"
57
+ warn "RSpec/InverseOfMatcher failed on #{source_name}: #{exception.message}"
58
58
  end
59
59
 
60
60
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Fourshark
5
- VERSION = '0.5.0'
5
+ VERSION = '0.6.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-fourshark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Ribeiro