rubocop-fourshark 0.2.3 → 0.4.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
- data/CHANGELOG.md +12 -0
- data/README.md +1 -0
- data/config/default.yml +20 -0
- data/lib/rubocop/cop/rails/bidirectional_association.rb +3 -3
- data/lib/rubocop/cop/rspec/inverse_of_matcher.rb +3 -3
- data/lib/rubocop/fourshark/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 323977d65563d11bb6f0323e33f617a6ebf3d0d168e4d81db5872e20844bdc3b
|
|
4
|
+
data.tar.gz: f98eeb1ae9869d48547843ba15352f3efb071874a36417c6d09d322f07ef46c3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b227ad96bae89887858523c73f2db4ad3b8990f686ca45a823d11afd9d17e2e01e71ecb5fed2b3b422143f4535be846d43af704cf0f8c0af5dace177141996e2
|
|
7
|
+
data.tar.gz: e7d059b06abbc9f4dad9b81cc76bd2e0499863f4997584ce6d4716b3a56e87b11492b3079df3a82ecbf70af3926a4035981b6c19f8e0f1f75bd23d1aa79cd3db
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [0.4.0] - 2026-06-29
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- `Layout/MultilineMethodCallIndentation` configured to `indented` — multiline method-call chains indent continuation calls one step from the receiver instead of aligning with the first call
|
|
6
|
+
|
|
7
|
+
## [0.3.0] - 2026-06-19
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `RSpec/Dialect` configured to forbid `subject`, `subject!` and `let!` in favor of a lazy `let`
|
|
12
|
+
|
|
1
13
|
## [0.2.3] - 2026-05-30
|
|
2
14
|
|
|
3
15
|
### Fixed
|
data/README.md
CHANGED
|
@@ -82,6 +82,7 @@ Where a 4Shark cop supersedes or contradicts a stock cop, `config/default.yml` t
|
|
|
82
82
|
|
|
83
83
|
| Cop | Intent |
|
|
84
84
|
|---|---|
|
|
85
|
+
| `RSpec/Dialect` | Use `let`, never `subject` or `let!` — every `subject`/`subject!`/`let!` is flagged in favor of a lazy `let` (force creation in an explicit `before`, not with `let!`). The implicit subject behind `is_expected` is a different method and is left untouched. Stock cop, configured via `PreferredMethods`. |
|
|
85
86
|
| `RSpec/InverseOfMatcher` | Root models must assert `.inverse_of` in association specs; subclasses must not (it belongs to the parent). Scoped to `spec/models`. |
|
|
86
87
|
| `RSpec/OverwrittenLet` | A `let`/`let!` must not override one defined in an outer example group — shadowing makes it ambiguous which value applies. Scenario-specific `let`s, and the same name across sibling contexts, are fine. |
|
|
87
88
|
| `RSpec/ConditionalInLet` | A `let` must not contain conditional logic (`if`/`case`) — branch with separate `context`s instead. Ternaries are allowed. |
|
data/config/default.yml
CHANGED
|
@@ -8,6 +8,12 @@ Layout/MultilineStatementSpacing:
|
|
|
8
8
|
Enabled: true
|
|
9
9
|
VersionAdded: '0.2.0'
|
|
10
10
|
|
|
11
|
+
# Stock cop configured (not a 4Shark cop): enforce the `indented` style for
|
|
12
|
+
# multiline method-call chains — continuation calls are indented one step from
|
|
13
|
+
# the receiver instead of aligning with the first call.
|
|
14
|
+
Layout/MultilineMethodCallIndentation:
|
|
15
|
+
EnforcedStyle: indented
|
|
16
|
+
|
|
11
17
|
Style/DisallowSafeNavigation:
|
|
12
18
|
Description: 'Do not use safe navigation (`&.`). Use explicit conditionals instead.'
|
|
13
19
|
Enabled: true
|
|
@@ -50,6 +56,20 @@ Rails/OrderedMacros:
|
|
|
50
56
|
- 'app/models/**/*.rb'
|
|
51
57
|
VersionAdded: '0.2.0'
|
|
52
58
|
|
|
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.
|
|
63
|
+
RSpec/Dialect:
|
|
64
|
+
Description: 'Use `let`, never `subject` or `let!` — objects are lazy `let`, forced in `before`.'
|
|
65
|
+
Enabled: true
|
|
66
|
+
PreferredMethods:
|
|
67
|
+
subject: let
|
|
68
|
+
subject!: let
|
|
69
|
+
let!: let
|
|
70
|
+
Include:
|
|
71
|
+
- 'spec/**/*_spec.rb'
|
|
72
|
+
|
|
53
73
|
RSpec/InverseOfMatcher:
|
|
54
74
|
Description: 'Root models must include `.inverse_of` in association specs; subclasses must not.'
|
|
55
75
|
Enabled: true
|
|
@@ -159,9 +159,9 @@ module RuboCop
|
|
|
159
159
|
return '' if name.nil?
|
|
160
160
|
|
|
161
161
|
name.gsub('::', '/')
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
.gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
|
|
163
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
|
164
|
+
.downcase
|
|
165
165
|
end
|
|
166
166
|
end
|
|
167
167
|
end
|
|
@@ -129,9 +129,9 @@ module RuboCop
|
|
|
129
129
|
# "UserAccount" → "user_account"; "Plan::Statement" → "plan/statement"
|
|
130
130
|
def camel_to_snake(name)
|
|
131
131
|
name.gsub('::', '/')
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
.gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
|
|
133
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
|
134
|
+
.downcase
|
|
135
135
|
end
|
|
136
136
|
end
|
|
137
137
|
end
|