kaizo 0.7.0 → 0.9.2

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: 7a167afcda94e477c2fd351f0f88c4c4f69b4adb987e0e74a59f50c516aa6080
4
- data.tar.gz: f002c0b1464262edc8eb988f046b935fb9347d2258585c143acc6dd46911f86b
3
+ metadata.gz: cad3868f708e0f017a8591fbc77881d53054d4fcc672c9a6adbfdb2ff7928834
4
+ data.tar.gz: 37b9f18bfd87518a2027ac6786352600d1c3d1f68153eeadbab8d964c835a90d
5
5
  SHA512:
6
- metadata.gz: 41ec7ca0e3f99dc13c761540b9ac7c06bd66f1cbcdecf776db8f1dd4dcd0c412008ae70f6ac73e6d9295662a27d70b3c2b2973930674ea7229fc1d173b4bb33e
7
- data.tar.gz: f3ea240a663c70959adf03f95c5b49452ae3ae71a93818b8dcdedcf8bf1b72f10acd9d1db95494e12f7ee592a3162b8590a5d99603caca710126c810147bdaca
6
+ metadata.gz: 74e87adf1362de156eac0285be0c51b89eec0b2209bf9371a3bf3ac52c41404b49c3f694bfebfea9ec9d3bf32ab572816e580575a39af5a568fc74bd844c91c5
7
+ data.tar.gz: 6789d9a9dabe6bcc17fb2d90702478d42d3593aed4e934743ed1f6c05946bfc1294d0a229173f1e345a1efc2f897a0f436630597ce33fac79e69430d50bc5cd6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,124 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.1
4
+
5
+ - `Kaizo/KeywordArguments` and `Kaizo/TotalArguments` no longer run on `spec/`
6
+ and `test/` trees: wide keyword interfaces are the testing idiom there
7
+ (FactoryBot-style `create`/`build` helpers), and a total bound would
8
+ re-police the keywords the exemption frees. Override with `Exclude: []` to
9
+ police tests too. `Kaizo/PositionalArguments` still runs everywhere --
10
+ positional arguments communicate nothing unless they are solo.
11
+ - Rewrite the README example-first: every cop section leads with its bad/good
12
+ example, a fourteen-cop table replaces the catalog paragraph, a real
13
+ `rubocop --only Kaizo` transcript opens the document, and the enablement
14
+ policy is stated plainly (every cop ships enabled; the plugin's
15
+ out-of-department changes are disabling `Style/RedundantBegin` and the
16
+ `Style/HashSyntax` shorthand enforcement shipped since 0.8.0).
17
+ - Verify the README in CI: `spec/readme_examples_spec.rb` executes every
18
+ example against the shipped config — bad code must be flagged by the cop
19
+ its marker names, good code must pass the whole department, YAML fences
20
+ must parse into real cops with shipped option keys, suffix claims run with
21
+ the documented merge applied, the console transcript is re-derived from the
22
+ cops, and every cop must have both a bad and a good example.
23
+ - Fix two rdoc errors found in review: `Kaizo/AgentNounClassName`'s
24
+ `inherit_mode` example was a no-op (`Ledger` is already a default), and
25
+ `Kaizo/ExplicitBegin`'s docs called re-enabling `Style/RedundantBegin` an
26
+ opt-out when it leaves both cops fighting; the opt-out is disabling
27
+ `Kaizo/ExplicitBegin`.
28
+ - Fix a README error found in review: the enablement policy named
29
+ `Style/RedundantBegin` as the only out-of-department change, omitting the
30
+ `Style/HashSyntax` shorthand enforcement the Public Config has shipped
31
+ since 0.8.0. The policy now names both, and a guard spec pins the Public
32
+ Config's foreign-cop list to exactly the two the README names.
33
+
34
+ ## 0.9.0
35
+
36
+ - Add `Kaizo/TempfileCreate` cop: requires temporary files to be created with
37
+ block-form `Tempfile.create`, the only temp-file API whose cleanup is
38
+ deterministic (the block closes and removes the file when it returns).
39
+ `Tempfile.new` and `Tempfile.open` are flagged — their cleanup rides on a GC
40
+ finalizer that may run late or never — as is blockless `Tempfile.create`,
41
+ which returns a plain `File` that is never removed automatically. A
42
+ block-pass argument (`Tempfile.create("x", &writer)`) counts as a block. No
43
+ autocorrection. Enabled by default.
44
+ - Add `Kaizo/SpecSubject` cop: requires the unit under test to be declared with
45
+ `subject`, not `let`. A `let`/`let!` is flagged when its block confidently
46
+ builds the class under test — a `.new` on `described_class`, on the constant
47
+ an enclosing `describe`/`context` names (full or short name), or on a
48
+ constant matching the spec's file name (`pool_spec.rb` names `Pool`,
49
+ `api_client_spec.rb` names `APIClient`). Deliberate second instances (an
50
+ `other` in an equality spec) are exempted with `AllowedMethods` /
51
+ `AllowedPatterns`, matched against the `let` name. Runs on `**/*_spec.rb`.
52
+ No autocorrection. Enabled by default.
53
+ - `Kaizo/SpecComment` no longer inspects `spec/helpers` or `spec/support` by
54
+ default: those directories hold infrastructure, not specs, and prose there is
55
+ legitimate. The exclusion is plain per-cop `Exclude` configuration, so
56
+ override it (`Exclude: []`) to police them again, or broaden/narrow the scope
57
+ with the standard `Include`/`Exclude` as before.
58
+ - `Kaizo/SpecDescriptionProse` no longer flags error class names in
59
+ descriptions: `it "raises Foo::Error"` passes, because the error is part of
60
+ the specified behavior — it is what the user ultimately sees raised. Any
61
+ constant path whose final segment ends in `Error` or `Exception` reads as
62
+ prose; the rest of the description is still checked.
63
+ - `Kaizo/SpecDescriptionProse` gains `AllowedPatterns`: regexps matched against
64
+ the whole description that exempt it from every rule — the ad-hoc escape
65
+ hatch for a description that must quote something code-shaped.
66
+ - **Renamed** `Kaizo/SpecDescriptionProse`'s options: `Conjunctions` is now
67
+ `ForbiddenWords` and `ContextPrefixes` is now `RequiredContextPrefixes`. The
68
+ old names said nothing about whether the lists include or exclude, or how
69
+ the filter works; the new ones do. This is a clean break: the old keys are
70
+ no longer read — RuboCop warns that the parameter is unsupported and the
71
+ shipped defaults apply — so rename them when upgrading.
72
+ - The argument-counting cops (`Kaizo/PositionalArguments`,
73
+ `Kaizo/KeywordArguments`, `Kaizo/TotalArguments`) gain `AllowedMethods` and
74
+ `AllowedPatterns`: exempt individual methods by name or regexp — e.g. allow
75
+ `#initialize` to gather collaborators while everything else stays under a
76
+ strict `Max`. Covers `def`, `def self.`, and the symbol/string
77
+ `define_method` forms.
78
+ - `Kaizo/PluralCollectionName`'s `ArrayMethods` list is now genuinely
79
+ configurable (the README already described it as such); the default list is
80
+ spelled out in the shipped config so `inherit_mode: merge` can extend it.
81
+ - Every cop's rdoc header now carries a `== Configuration` section documenting
82
+ each option, its semantics, and its default, with a ready-to-paste
83
+ `.rubocop.yml` snippet — the config plane was previously undocumented at the
84
+ class level.
85
+
86
+ ## 0.8.0
87
+
88
+ - Add `Kaizo/PluralCollectionName` cop: flags a method that returns an array
89
+ under a singular name (`def user` handing back `[first, second]`), since a
90
+ plural name documents what the caller gets. Ruby has no return types, so the
91
+ detection is a heuristic and errs toward silence — a method is flagged only
92
+ when every value it can return is unambiguously an array, so one branch
93
+ returning `nil` keeps it quiet. `ArrayMethods` covers calls whose result is an
94
+ `Array` whatever the receiver; `select` and `reject` are excluded on purpose,
95
+ since on a `Hash` they return a `Hash`. Predicate, writer, and operator
96
+ methods are exempt, as is `initialize`. `IrregularPlurals` handles plurals
97
+ without a trailing `s`. No autocorrection. Enabled by default.
98
+ - The argument-counting cops (`Kaizo/PositionalArguments`, `Kaizo/TotalArguments`,
99
+ `Kaizo/KeywordArguments`) no longer flag **operator methods**. The arity of `[]=`
100
+ is fixed by Ruby's syntax — an index (or indices) plus the assigned value — so it
101
+ cannot be modeled away; the same holds for `[]`, `<=>`, `+`, `<<`, `==`, and the
102
+ rest of the operator family. Covers `def`, `def self.`, and the
103
+ `define_method(:[]=)` form; a `define_method` whose name is computed at runtime is
104
+ still checked, since the name cannot be known statically. This joins the existing
105
+ `Struct.new`/`Data.define` `initialize` exemption. Ordinary writers
106
+ (`def name=(value)`) are unaffected.
107
+ - The Public Config now ships `Style/HashSyntax` with
108
+ `EnforcedShorthandSyntax: always`, preferring Ruby 3.1's hash-value shorthand
109
+ (`Session.new(table:)` over `Session.new(table: table)`). Override it in your own
110
+ config if you want the explicit form. *(Landed on `master` after 0.7.0 was
111
+ published, so it has not reached gem users yet and was never recorded here.)*
112
+ - Expanded the `Kaizo/NestedMethodCalls` README guidance to spell out that the
113
+ *name* is the point, not the assignment — extracting to a local called `result`
114
+ or `tmp` satisfies the rule while missing what it asks for. The offense message
115
+ itself is unchanged.
116
+
117
+ ## 0.7.0
118
+
119
+ - No user-facing changes. Internal tooling and gem metadata only — nothing in
120
+ the shipped cops or their configuration differed from 0.6.0.
121
+
3
122
  ## 0.6.0
4
123
 
5
124
  - **Renamed the gem from `rubocop-design` to `kaizo`**, and moved every cop from