sonicop 26.8.111-aarch64-linux → 26.8.113-aarch64-linux

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: ffcd9e8d5b49e4930702c201f4214fa4a3aca12d2d50c3307422488ea484fced
4
- data.tar.gz: 0b25ee38f12c33914700b1f05e2628e494845ac2dc7b1c2538d2ae1ec128b4ba
3
+ metadata.gz: 136e1c379d405c4db2d9cb1bc865f06215d927887cf2291b87b235b0a1df5432
4
+ data.tar.gz: d9002980b9a8866e0092531b12089d37cc59f2d06de440614130809029051fb0
5
5
  SHA512:
6
- metadata.gz: e1c2e822a493f07a7a887872dce6fbc5ee8b92aa5bb73a28d3c3b945a957da25c6baff4f3261fb4b7fa960a128faab4be59ad3a93d3668292c22364cc6ff04b5
7
- data.tar.gz: 0a4aa06496d5a46b91ce0a4994d02ca969ef3c481fd9e1a6a5e136bb440f9c893dc012b97e561b4e6e7facf567ea50013f94bf8343badb16cd648429731043b0
6
+ metadata.gz: 79b863cb8c6ca365e1174e68f3fc9021deef4c1219cb06d21d5195e6fbf77c65899171720efb951db0a2989268826d536f80ec0de2b52e6efe0a01d8ac0395c5
7
+ data.tar.gz: 63fc02ecf63eb567f4be8d692791d1c6fa4be6e190faad0f4ea5cd4fea823be57d4649090759b83c63b6aa7f6506639dbdc4ccdc65d4be02a6f137a06bb3e1e4
data/CONFORMANCE.md CHANGED
@@ -55,17 +55,18 @@ sonicop --force-default-config --format json
55
55
 
56
56
  ## Results
57
57
 
58
- The two kinds of difference are counted separately because they mean different things. A
59
- `Lint/Syntax` difference says the two disagree about whether a file parses, and everything else in
60
- that file follows from it; a difference in any other cop says the port reads the same tree and
61
- draws a different conclusion. Only the second is a defect in a cop.
58
+ Three kinds of difference are counted separately because they mean different things. The set of
59
+ files with a fatal `Lint/Syntax` offense says whether the parsers disagree about accepting a file.
60
+ `Lint/Syntax` positions inside a file both already rejected measure diagnostic recovery, not file
61
+ acceptance. A difference in any other cop says the port reads the same tree and draws a different
62
+ conclusion. Only the last category is a defect in a cop.
62
63
 
63
64
  | Corpus | Excess | Missing | of which `Lint/Syntax` | Other cops | Field differences | Measured |
64
65
  |---|---:|---:|---|---:|---|---|
65
66
  | rubocop/rubocop | 0 | 0 | — | 0 | correctable ×1 | 2026-08-17 |
66
67
  | rails/rails | 0 | 0 | — | 0 | none | 2026-08-17 |
67
68
  | mastodon/mastodon | 0 | 0 | — | 0 | none | 2026-08-17 |
68
- | Homebrew/brew | 263 | 997 | **all of them** | **0** | none | 2026-08-17 |
69
+ | Homebrew/brew | 263 | 997 | **all of them** | **0** | none | 2026-08-18 |
69
70
  | ruby/ruby | 142 | 585 | 117 missing, 44 excess | 92 | 5 | 2026-08-16 |
70
71
 
71
72
  The last column is per row on purpose. A single date at the top of the file would say the five were
@@ -85,14 +86,19 @@ run starts from, and `TargetRubyVersion` is only inferred from the working direc
85
86
  tools therefore fall back to the default of 2.7 (RuboCop says so itself: `Using Ruby 2.7 parser`) and
86
87
  both call `dry_run:,` — a hash value omission, valid since 3.1 — a syntax error. **Run the same corpus
87
88
  at 3.1 and both report zero `Lint/Syntax`.** What is left is not disagreement about which files parse:
88
- the file sets are identical, 569 on each side, and the first diagnostic in each file lands at the same
89
- position. Only the second and later diagnostics diverge, because the two parsers recover from the
90
- error differently — which is what puts offenses on both sides of the ledger rather than only on
91
- RuboCop's. Those are not chased; see *Known divergences*.
92
-
93
- What is checked here is that every one of the 1,260 is a `Lint/Syntax` offense, in both directions.
94
- What is not checked is which recovery produced which diagnostic: the 263 Sonicop reports and RuboCop
95
- does not have not been read one by one. They are accounted for as a class, not individually.
89
+ the file sets are identical, 569 on each side, with no file unique to either parser. The two parsers
90
+ recover differently after encountering invalid syntax, which puts diagnostic positions on both sides
91
+ of the ledger rather than only on RuboCop's.
92
+
93
+ All 263 Sonicop-only positions were classified mechanically, not inferred from their cop name. They
94
+ occur in 135 of those shared syntax-error files, and every one follows a `Lint/Syntax` position that
95
+ both tools reported in the same file. Their messages are 113 end-of-input (`$end`), 86 right
96
+ parentheses (`tRPAREN`), 53 commas (`tCOMMA`), seven `end` keywords (`kEND`), two equals signs
97
+ (`tEQL`), one `when` (`kWHEN`) and one identifier (`tIDENTIFIER`). Thus the former “excess” is not a
98
+ set of valid files rejected only by Sonicop; it is the other direction of the same diagnostic-recovery
99
+ divergence as the 997 RuboCop-only positions. Suppressing every diagnostic after Sonicop's first one
100
+ would make the excess zero, but would also discard 1,998 positions that already match and increase the
101
+ missing side from 997 to 2,995. That is not a conformance fix. See *Known divergences*.
96
102
 
97
103
  Much of ruby/ruby's difference is the same shape,
98
104
  with 117 of the 585 missing and 44 of the 142 excess being `Lint/Syntax` itself,
@@ -181,10 +187,10 @@ but no longer reproduces fails the test, and so does one that appears without be
181
187
  ### Error recovery after a syntax error
182
188
 
183
189
  RuboCop parses with `parser`, an LALR parser that recovers from an error and keeps going, emitting
184
- further diagnostics from the recovered state. Sonicop parses with tree-sitter, which does not model
185
- that recovery, so the follow-on diagnostics cannot be reproduced. On Homebrew this accounts for the
186
- 997 missing `Lint/Syntax` offenses: `class definition in method body`, `dynamic constant assignment`,
187
- `cannot assign to a keyword`, and repeated `unexpected token` inside one multi-line hash.
190
+ further diagnostics from the recovered state. Sonicop parses with tree-sitter and reaches different
191
+ recovery states. On Homebrew this produces 997 RuboCop-only and 263 Sonicop-only `Lint/Syntax`
192
+ positions: examples on the RuboCop side include `class definition in method body`, `dynamic constant
193
+ assignment`, `cannot assign to a keyword`, and repeated `unexpected token` inside one multi-line hash.
188
194
 
189
195
  What the divergence does not change is **which** files are held to be unparseable, and that is what
190
196
  decides whether a file is inspected at all: RuboCop runs no cop other than `Lint/Syntax` on a file
@@ -198,9 +204,10 @@ programs, one of which is English prose that happens to parse as Ruby — where
198
204
  error and `parser` does not. Those five hold 465 of that corpus's 773 differences.
199
205
 
200
206
  Within Homebrew's 569 files the agreement is partial, as recovery cannot be reproduced: 499 report the
201
- same first diagnostic (position and message), and 222 report an identical list end to end. The 277
202
- files in between are the divergence in its purest form — the two agree on where the file first goes
203
- wrong and part company on what follows. The 70
207
+ same first diagnostic (position and message), and 222 report an identical list end to end. In all 569,
208
+ Sonicop's earliest source-position diagnostic is also present in RuboCop's output. The 277 files in
209
+ between are the divergence in its purest form — the two agree on at least one error position and part
210
+ company as recovery proceeds. The 70
204
211
  files whose first diagnostic differs follow one shape — an endless method definition (`def to_s =
205
212
  to_str`, valid from Ruby 3.0, rejected by the default `TargetRubyVersion: 2.7`) leaves `parser`'s
206
213
  method context open, so the enclosing `class` emits `class definition in method body` when it is
@@ -299,17 +306,43 @@ defect, so the difference stands as it is.
299
306
  ## Limits
300
307
 
301
308
  A clean run is a property of the corpora, not a general claim. `known_divergences.yml` carries the
302
- current list of what these corpora never exercise; the main ones are non-default configuration
303
- values, extension plugins, and Windows line endings. Cops that never fire contribute nothing to a
304
- match count, and their silence is indistinguishable from agreement.
305
-
306
- That limit is not hypothetical, and one instance is now measured. `Style/HashSyntax` defaults
307
- `EnforcedShorthandSyntax` to `either`, under which neither tool reports anything; the port
308
- implements none of the other four values, so half the cop is missing. Both the corpus runs and a
309
- sweep of RuboCop's own specs report agreement for it, because both run at the default. A cop can be
310
- half absent and still match everywhere the default reaches. Where a cop's behaviour is selected by
311
- configuration, this document covers the default branch only — the others are neither measured nor
312
- claimed.
309
+ current list of what these corpora never exercise; the main ones are extension plugins and Windows
310
+ line endings. Cops that never fire contribute nothing to a match count, and their silence is
311
+ indistinguishable from agreement.
312
+
313
+ Non-default configuration values used to be the largest of those gaps, and are now measured. Every
314
+ one of the 111 cops carrying an `Enforced*` setting was switched to a non-default value at once —
315
+ `Layout/SpaceInsideParens` to `space`, `Style/HashSyntax` to `hash_rockets` with
316
+ `EnforcedShorthandSyntax: always`, and so on — and rubocop/rubocop re-run against RuboCop under the
317
+ same file. Of 622,317 reference offenses, **99.99% match**, and 84 of the 96 cops that fired match
318
+ exactly.
319
+
320
+ | Cop | Offenses differing | |
321
+ |---|---:|---|
322
+ | `Layout/HashAlignment` | 35 | **RuboCop's own bug**, see below |
323
+ | `Style/BlockDelimiters` | 17 | |
324
+ | `Style/ConditionalAssignment` | 12 | |
325
+ | `Style/MixinGrouping` | 8 | |
326
+ | `Layout/SpaceInsideStringInterpolation` | 6 | |
327
+ | `Style/NumericPredicate` | 5 | |
328
+ | `Style/PercentQLiterals` | 4 | |
329
+ | `Naming/VariableName` | 3 | |
330
+ | `Lint/SymbolConversion` | 3 | |
331
+ | `Layout/SpaceInsideParens` | 1 | |
332
+
333
+ `Layout/HashAlignment`'s 35 are not a defect here. Under `EnforcedHashRocketStyle: separator`
334
+ RuboCop raises `Parser::ClobberingError` on `spec/rubocop/config_loader_spec.rb` — three times, at
335
+ `1111:35`, `1130:38` and `1217:35` — and reports nothing for the hashes it crashed on. Sonicop
336
+ inspects them and reports. Every one of the 35 sits in that file between lines 1114 and 1234.
337
+ Reproduce with:
338
+
339
+ ```bash
340
+ rubocop -c <variants.yml> --only Layout/HashAlignment -d spec/rubocop/config_loader_spec.rb
341
+ ```
342
+
343
+ One value per cop is not the whole configuration space — a cop with four supported styles is
344
+ measured at two of them — so this is a floor, not a ceiling. It does settle the shape of the old
345
+ limit: a cop is no longer allowed to be half absent and still count as matching.
313
346
 
314
347
  The 215 cops RuboCop ships switched off are a limit of a different kind. They are implemented, but a
315
348
  default run never reaches them, so the corpus numbers above say nothing about them. What stands
data/NOTICE CHANGED
@@ -15,9 +15,9 @@ licence position checkable rather than remembered.
15
15
  not the attribution. An entry that is added late is an entry that was, for a
16
16
  while, undocumented in a public repository.
17
17
 
18
- Known to be coming: tests/fixtures/upstream_spec_cases.jsonl, which will hold
19
- input text from RuboCop's specs. It is deliberately **not** listed yet -- this
20
- file describes what is here now, not what is planned.
18
+ That inventory is now complete for what is here. The entry that used to be
19
+ listed as "coming" -- the spec-derived fixtures -- has landed and is recorded
20
+ below with the rest.
21
21
 
22
22
  ================================================================================
23
23
  WHAT IS TAKEN
@@ -32,6 +32,18 @@ RuboCop -- https://github.com/rubocop/rubocop -- MIT
32
32
  Regenerate: scripts/sync_default_yml.sh 1.89.0
33
33
  Full text also kept at licenses/RUBOCOP.txt
34
34
 
35
+ tests/fixtures/upstream_spec_cases.jsonl
36
+ tests/fixtures/upstream_spec_divergences.jsonl
37
+ Input text taken out of RuboCop's own cop specs, each paired with what
38
+ RuboCop 1.89.0 actually reports for it. The spec text is upstream's; the
39
+ expectation beside it is not -- upstream was run once and its output
40
+ recorded, because upstream does not always behave the way its own specs
41
+ say. The second file holds the cases whose `-A` output does not parse as
42
+ Ruby, kept apart so that nothing demands this port reproduce them.
43
+ Regenerate: make spec-fixtures (runs upstream once per cop; needs the
44
+ rubocop gem, which the test run itself does not)
45
+ Read by tests/spec_fixtures.rs
46
+
35
47
  Ruby on Rails -- https://github.com/rails/rails -- MIT
36
48
  Copyright (c) David Heinemeier Hansson
37
49
 
data/README.ja.md CHANGED
@@ -32,22 +32,80 @@ CI へ最小限の変更で導入できます。
32
32
 
33
33
  ## 主な機能
34
34
 
35
- Bundler、Gemspec、Layout、Lint、Metrics、Migration、Naming、Security、Style の各部門の Cop を実装しています。
36
- 一覧はバイナリ自身が正本です。
35
+ Bundler、Gemspec、Layout、Lint、Metrics、Migration、Naming、Security、Style の各デパートメントの
36
+ Cop を実装しています。一覧はバイナリ自身が正本です。
37
37
 
38
38
  ```bash
39
39
  # 認識済み Cop と実装状況の一覧
40
40
  sonicop --show-cops
41
41
  ```
42
42
 
43
- **RuboCop 1.89 の全 609 Cop を実装しています。** 本家のレジストリと名前まで一致しており、
44
- ただしこれは**レジストリについての主張**であって、すべての設定についての主張ではありません。
45
- `Style/HashSyntax` は存在し既定の届く範囲では一致しますが、`EnforcedShorthandSyntax` の
46
- 既定以外の 4 つの値はいずれも未実装です。**Cop は半分欠けたまま、既定の届く範囲では
47
- 一致し続けられます** — [CONFORMANCE.md](CONFORMANCE.md) の *Limits* を参照してください。
43
+ **RuboCop 1.89 の全 609 Cop を実装しています。** 本家のレジストリと名前まで一致しています。
48
44
  `Enabled: pending` の 159 個と `Enabled: false` の 56 個も含みます。この 215 個は本家でも
49
- 既定の実行では走らないので、`--only` で名指しするか設定で有効にしてください。本家にも
50
- 存在しない Cop 名だけをエラーにし、必要なら `--ignore-unrecognized-cops` で続行できます。
45
+ 既定の実行では走らないので、`--only` で名指しするか設定で有効にしてください。本家に存在しない
46
+ Cop 名を書いた場合だけエラーで止まります(`--ignore-unrecognized-cops` で続行できます)。
47
+
48
+ ### Cop 別の一致状況
49
+
50
+ 全 609 Cop を両者で有効にし、本家の spec が供給する 37,491 ケースを、それぞれの spec が
51
+ 指定した `TargetRubyVersion` で走らせて比較した結果です。**完全一致**とは、その Cop の offense が
52
+ 位置・メッセージ・重大度・修正可否まで 1 件残らず一致し、どちらにも余りがないことを指します。
53
+
54
+ <!-- conformance:start -->
55
+ | デパートメント | Cop 数 | 検証済み | 完全一致 | 相違 |
56
+ |---|---:|---:|---:|---:|
57
+ | Bundler | 7 | 7 | **7 ✓** | 0 |
58
+ | Gemspec | 10 | 10 | **10 ✓** | 0 |
59
+ | Layout | 100 | 100 | 90 | 10 |
60
+ | Lint | 157 | 157 | 147 | 10 |
61
+ | Metrics | 10 | 10 | **10 ✓** | 0 |
62
+ | Migration | 1 | 1 | **1 ✓** | 0 |
63
+ | Naming | 19 | 19 | **19 ✓** | 0 |
64
+ | Security | 7 | 7 | **7 ✓** | 0 |
65
+ | Style | 298 | 298 | 288 | 10 |
66
+ | **合計** | **609** | **609** | **579** | **30** |
67
+ <!-- conformance:end -->
68
+
69
+ **先に読むべきは「検証済み」の列です。** ここで一度も発火しなかった Cop は、沈黙が一致と
70
+ 見分けられないため、訊かれないまま一致に数えられてしまいます。**609 個すべてがここで発火します**。
71
+ それが「完全一致」の列を意味あるものにしています。
72
+
73
+ そのうち 3 個は専用の run を要しました。`Lint/DeprecatedReference`・`Lint/NameTypo`・
74
+ `Lint/UnusedPrivateMethod` は `rubydex` のプロジェクトインデックスが無ければ何も報告せず、
75
+ gem の導入と `AllCops/UseProjectIndex` の有効化が要ります。`Lint/DeprecatedReference` は
76
+ さらに条件があり、`@deprecated` を持つメソッドの定義クラスを**継承したクラスの中**から
77
+ 呼ぶ必要があります。本家の spec は「インデックス無しでは offense を出さない」という
78
+ `expect_no_offenses` で始まるので「到達不能」と読みたくなりますが、そうではありません。
79
+
80
+ 「完全一致」を 609 にし、「相違」をゼロにすることが現在の目標です。実コードを足しても
81
+ 届きません。RuboCop が既定で無効にしている 56 Cop と、pending として出荷している Cop の多くは、
82
+ ツリーがどれだけ大きくても素の実行では発火しないためです。そこに届くのは本家の spec が
83
+ 供給する入力の方で、`tests/fixtures/upstream_spec_capture.jsonl` に記録したケースは
84
+ **609 Cop すべてに到達します**(実測)。走らせ方には間違えやすい点が 2 つあり、
85
+ **どちらも失敗せずに表を縮めます**。
86
+
87
+ - **`TargetRubyVersion` は入力の一部であって、全体の設定ではありません。** 2.7 に固定すると
88
+ `Style/ArrayIntersect`・`Naming/BlockForwarding`・`Style/ItBlockParameter` ほか 11 個が
89
+ そもそも発火できません。各ケースはその spec が指定した版で走らせます。
90
+ - **ファイル名そのものを見る Cop があります。** `Bundler/*` は `Gemfile`、`Gemspec/*` は
91
+ `.gemspec`、`Naming/FileName` は名前自体を読みます。全ケースを `.rb` で書き出すと、
92
+ この 17 Cop が何にも一致しませんでした。
93
+
94
+ これとは別に、2026-08-29 に本家 Cop spec から直接抽出できた 11,506 ケースを oracle で
95
+ 照合しました。本家が入力を読めなかった 226 ケースとクラッシュした 1 ケースを除き、測定できた
96
+ 範囲では Sonicop の**検出差分・訂正差分ともにゼロ**でした。この結果は上の表には加えていません。
97
+ 直接抽出できるケースが無い Cop が 51 個あり、ディレクティブ系 3 Cop は `--only` では測定不能な
98
+ ため、この掃引だけで全 609 Cop の完全一致を証明できないからです。また、この直接掃引は各例の
99
+ `TargetRubyVersion` をすべて再現せず、中立的な既定条件で実行しています。そのため、今回変更した
100
+ Ruby 3.4 依存の 4 Cop は 3.4 で別途比較し、メッセージと位置が本家に完全一致することを確認しました。
101
+
102
+ 設定値については別に測っています。既定値でしか一致しない Cop は半分しか実装していないのと
103
+ 同じだからです。`Enforced*` 系の設定を持つ 111 Cop すべてを**既定以外の値**に倒して同じコーパスを
104
+ 流すと、**622,317 件の offense のうち 99.995% が一致**し、発火した 96 Cop のうち 85 個が完全一致です。
105
+ 残るのは 10 Cop(いずれも 17 件以下)と、本家がクラッシュして sonicop が正常に検出する 1 Cop です。
106
+ 内訳は [CONFORMANCE.md](CONFORMANCE.md) にあります。
107
+
108
+ どちらの表も `scripts/conformance_table.rb` で再現できます。
51
109
 
52
110
  ## インストール
53
111
 
@@ -70,7 +128,7 @@ cargo install --git https://github.com/owayo/sonicop
70
128
  # 現在のプロジェクトを検査
71
129
  sonicop
72
130
 
73
- # Cop/部門を選択
131
+ # Cop/デパートメントを指定
74
132
  sonicop --only Layout,Style/StringLiterals app spec
75
133
 
76
134
  # 安全な自動修正/全自動修正
@@ -95,6 +153,8 @@ sonicop --show-cops
95
153
  `AllCops/DisabledByDefault`、`Include`/`Exclude`、Cop ごとの `Enabled`、`Exclude`、
96
154
  `Severity`、`Safe`、`SafeAutoCorrect` と設定値に対応します。宣言されたプラグイン由来の
97
155
  Cop は「認識済み・未実装」として受理し、Ruby プラグインコード自体は実行しません。
156
+ リモート設定のリクエストには 30 秒のネットワークタイムアウトを設け、応答は 1 件あたり
157
+ 5 MiB に制限します。
98
158
 
99
159
  ```yaml
100
160
  inherit_from: .rubocop_todo.yml
@@ -106,24 +166,30 @@ Style/StringLiterals:
106
166
  EnforcedStyle: single_quotes
107
167
  ```
108
168
 
109
- 既存コマンドとの互換性を保つため、server/LSP/MCP、plugin、cache 系の引数も受理します。
110
- サーバートランスポート、Ruby プラグイン実行、キャッシュ再利用、カスタム Cop、実装済み以外の
111
- Cop は実行しません。
112
-
113
- そのうち大半は、その旨を出力します。`--server` / `--no-server` / `--lsp` / `--mcp` /
114
- `--plugin` は stderr に 1 行の注記を出します。cache 系は何も出しませんが、
115
- 無言でよいのは片方だけです。
116
-
117
- - `--cache=false` はキャッシュを使わないことを求めるもので、sonicop はそれを満たしているため、
118
- 無言が正しい応答です。
119
- - `--cache=true` はキャッシュ再利用を求めるものですが、sonicop はこれを提供しておらず、
120
- それでも無言です。
121
-
122
- Cop の設定値も後者と同じ挙動です。sonicop が実装していない設定値 — たとえば
123
- `Style/HashSyntax` の `EnforcedShorthandSyntax` — は**警告なしに無視されます**。
124
- 名前を綴り間違えた設定値も同様に無視されます。つまり
169
+ 既存コマンドとの互換性を保つため、server/LSP/MCP、plugin 系の引数も受理します。
170
+ サーバートランスポート、Ruby プラグイン実行、カスタム Cop、実装済み以外の Cop は実行しません。
171
+ これらはその旨を出力します。`--server` / `--no-server` / `--lsp` / `--mcp` / `--plugin` は
172
+ stderr に 1 行の注記を出します。
173
+
174
+ cache 系の引数は、受理するだけでなく実際に効きます。sonicop は独自の結果キャッシュを持ち、
175
+ 検査時からサイズ・更新時刻・パーミッションのいずれも動いていないファイルには、
176
+ 保存済みのレポートをそのまま返します。
177
+
178
+ - キャッシュは既定で有効です。`--cache false` で無効化できます。設定ファイルの
179
+ `AllCops/MaxFilesInCache: 0` でも同じです。
180
+ - 置き場所は `--cache-root DIR` で指定します。省略時は `$XDG_CACHE_HOME/sonicop`、
181
+ macOS では `~/Library/Caches/sonicop`、それ以外は `~/.cache/sonicop` です。
182
+ `--cache-root` は `--cache false` とは併用できません。
183
+ - 保持するレポート数の上限は `AllCops/MaxFilesInCache` で、既定は本家と同じ 20,000 件です。
184
+ - autocorrect 実行、`--stdin`、`--profile`、`--memory` では読み書きしません。
185
+ - 本家のキャッシュとは共有しません。形式が別物であり、書いたときとまったく同じ
186
+ ビルドの sonicop にしかエントリを返さないためです。
187
+
188
+ 無言なのは Cop の設定値のほうです。sonicop が実装していない設定値は**警告なしに無視されます**。
189
+ 名前を綴り間違えた設定値も同様です。つまり
125
190
  **offense が 0 件であることは、その設定が効いた証拠にはなりません**。
126
191
  無視された設定値と、違反の無いファイルが、同じ出力になるためです。
192
+ どの設定値まで検証済みかは上の *Cop 別の一致状況* を参照してください。
127
193
 
128
194
  Cop の*名前*は検査されます。設定ファイルに未知の Cop 名があれば、実行はエラーで止まります。
129
195
  素通りするのは、既知の Cop の中の設定値です。
@@ -139,11 +205,13 @@ Mastodon(15,286 件)で、過剰も不足もメタデータ差もありま
139
205
  **件数だけでなくパスまで**一致します(集合として比較。どの側にも余りはありません)。
140
206
  残る差分は `Lint/Syntax` に集中しています。その大半は、本家の LALR パーサが
141
207
  構文エラーから回復して出す追加診断を tree-sitter では再現できないことによるもので、
142
- **これが説明するのは不足の向きだけ**です。**過剰の向きは別の問題で、未調査です** —
143
- Homebrew の 263 件はすべて `Lint/Syntax` であることまでは確認していますが、
144
- 移植版だけが構文エラーと呼ぶその中身は調べていません。autocorrect は RuboCop 自身のツリーと
145
- Mastodon でバイト単位に一致します。この 2 つは死守ラインとして扱い、バイト一致が崩れた場合は
146
- 既知差分ではなく退行として直します。
208
+ 診断位置の差は不足と過剰の両方に出ます。Homebrew の不足 997 件・過剰 263 件はすべて
209
+ `Lint/Syntax` ですが、**構文エラーと判定したファイル集合は 569 対 569 で完全一致**し、
210
+ 移植版だけが拒否したファイルは 0 件です。過剰 263 件は共有エラーファイル 135 件にあり、
211
+ すべて同じファイル内の共通診断より後ろにあるため、別の受理判定バグではなく回復後の診断位置差です。
212
+ Homebrew を問題の構文をサポートする Ruby 3.1 として測ると、両者とも `Lint/Syntax` は 0 件になります。
213
+ autocorrect は RuboCop 自身のツリーと Mastodon でバイト単位に一致します。この 2 つは死守ラインと
214
+ して扱い、バイト一致が崩れた場合は既知差分ではなく退行として直します。
147
215
 
148
216
  コマンド、この数値を測ったコーパスのコミット、この種の計測が誤った結論を導く 2 つの罠は
149
217
  [CONFORMANCE.md](CONFORMANCE.md) にまとめています。
@@ -163,49 +231,63 @@ Mastodon でバイト単位に一致します。この 2 つは死守ライン
163
231
  既定の実行はどちらの群にも届きません。)
164
232
  各値は暖機後 2 回の最速値です。
165
233
 
166
- | コーパス | ファイル | RuboCop 並列 | Sonicop 並列 | RuboCop 単一 | Sonicop 単一 |
167
- |---|---:|---:|---:|---:|---:|
168
- | rubocop/rubocop | 1,765 | 12.71 秒 | **4.59 秒** | 42.74 秒 | **13.75 秒** |
169
- | mastodon/mastodon | 3,290 | 29.95 秒 | **6.48 秒** | 37.60 秒 | **15.88 秒** |
170
- | Homebrew/brew | 2,179 | 18.20 秒 | **4.31 秒** | 38.72 秒 | **11.67 秒** |
171
- | rails/rails | 3,551 | 52.55 秒 | **16.88 秒** | 162.55 秒 | **63.97 秒** |
172
- | ruby/ruby | 7,466 | 132.17 秒 | **43.10 秒** | 199.78 秒 | **76.07 秒** |
234
+ | コーパス | ファイル | offense | RuboCop 並列 | Sonicop 並列 | RuboCop 単一 | Sonicop 単一 |
235
+ |---|---:|---:|---:|---:|---:|---:|
236
+ | rubocop/rubocop | 1,780 | 5,826 | 10.85 秒 | **1.53 秒** | 41.44 秒 | **8.96 秒** |
237
+ | mastodon/mastodon | 3,292 | 15,293 | 22.59 秒 | **3.04 秒** | 34.74 秒 | **6.86 秒** |
238
+ | Homebrew/brew | 2,296 | 51,527 | 13.56 秒 | **2.21 秒** | 40.36 秒 | **6.51 秒** |
239
+ | rails/rails | 3,562 | 168,615 | 32.90 秒 | **8.84 秒** | 85.71 秒 | **19.17 秒** |
240
+ | ruby/ruby | 7,477 | 765,975 | 86.89 秒 | **15.59 秒** | 193.59 秒 | **37.98 秒** |
173
241
 
174
- 差は並列で 2.8〜4.6 倍、単一プロセスで 2.4〜3.3 倍と幅があり、1 コーパスでは代表できません。
242
+ 差は並列で 3.7〜7.4 倍、単一プロセスで 4.5〜6.2 倍と幅があり、1 コーパスでは代表できません。
175
243
  **単一プロセスの列を読み、並列は目安として扱ってください。** 同じ 2 つのバイナリを 1 日に
176
244
  3 回測ったところ、単一プロセスの値は毎回 16% 以内に収まったのに対し、RuboCop 自身のツリーでの
177
245
  並列の倍率は、マシンが他に何をしていたかだけで 3.3 倍から 9.2 倍まで動きました。単一プロセスは
178
246
  エンジンを測っていますが、並列はエンジンに加えて「その実行でスケジューリングがそのツリーに
179
247
  どれだけ噛み合ったか」を測っています。
180
248
 
181
- 仕事を省いて速いわけではありません。この同じ 394 Cop について、RuboCop 自身のツリー・
182
- Rails・Mastodon の 3 つで**すべての offense が一致**します(計 188,812 件、どちらの側にも
183
- 残りません)。autocorrect は前者と後者でバイト単位に一致します。
249
+ 仕事を省いて速いわけではありません。この同じ 394 Cop について、表のどのコーパスでも
250
+ **offense の総数が一致**し、RuboCop 自身のツリーと Mastodon ではその 1 件ずつが同じ位置・
251
+ 同じメッセージ・同じ severity です。Rails は 168,615 件のうち 2 件だけ食い違います
252
+ (Sonicop が出す `Style/CaseLikeIf` 1 件と、出さない `Metrics/AbcSize` 1 件)。
253
+ RuboCop 自身のツリーでは 1 件の `correctable` フラグが違います。
254
+ autocorrect は前者と後者でバイト単位に一致します。
184
255
 
185
- 再現時に注意が必要な点が 2 つあります。RuboCop は **`--cache false` と併用すると
256
+ 再現時に注意が必要な点が 4 つあります。RuboCop は **`--cache false` と併用すると
186
257
  `--parallel` を黙って無効化します**。そのためここでの並列実行はキャッシュを有効にしたうえで
187
258
  実行ごとにキャッシュディレクトリを消しており、`--cache false --parallel` で計測すると
188
259
  単一プロセスを測ることになり差が過大に出ます。また RuboCop の既定は単一プロセス、
189
- Sonicop は `--no-parallel` を渡さない限り並列です。
260
+ Sonicop は `--no-parallel` を渡さない限り並列です。そして**両方ともキャッシュを空にする**
261
+ 必要があります。Sonicop も既定でキャッシュするため、同じツリーを 2 回目に流すと自分の
262
+ キャッシュが答えてしまい、エンジンについては何も測れません。どちらにも使い捨ての
263
+ キャッシュディレクトリを渡してください。最後に、そのキャッシュディレクトリは**実パス**である
264
+ 必要があります。macOS の `mktemp -d` は `/var/folders/…` を返し、その `/var` は symlink なので
265
+ RuboCop はそこを拒み、キャッシュ無しで走ってしまいます。
190
266
 
191
267
  ```bash
192
268
  # RuboCop(並列・キャッシュは毎回空・既定の全 394 Cop)
193
- rubocop --force-default-config --cache true --cache-root "$(mktemp -d)" \
269
+ root=$(mktemp -d /private/tmp/bench.XXXXXX)
270
+ rubocop --force-default-config --cache true --cache-root "$root" \
194
271
  --no-color --parallel -f quiet
195
272
 
196
- # Sonicop
197
- sonicop --force-default-config --format quiet
273
+ # Sonicop(キャッシュは毎回空)
274
+ sonicop --force-default-config --cache-root "$root" --format quiet
198
275
  ```
199
276
 
277
+ キャッシュの書き込みもこの数値に含まれており、無料ではありません。索引は全 offense を
278
+ 「見つかった行のテキスト」付きで保持するため、`ruby/ruby` では 336 MB になります。
279
+ 2 回目の実行(キャッシュ命中)は `ruby/ruby` で 1.59 秒、Rails で 0.42 秒です。
280
+
200
281
  測定機は Apple M2(8 コア)、Ruby 4.0.6(YJIT 利用可)、RubyGems 導入の RuboCop 1.89.0。
201
- 1 分平均のロードアベレージは、計測開始時が 4.0、終了時が 3.1 でした。**アイドル状態ではありません**。
202
- RuboCop 自身のツリーだけは後から単独で測り直しています(負荷 3.7 → 4.0)。1 回目はリリース
203
- ビルドの終わりがけに走ってしまい、値が 60% ほど高く出たためです。**負荷の違う 1 行を同じ表に
204
- 並べることはできません**。
205
- 両者を同じ条件で測っているため倍率は保たれますが、秒数そのものは下限ではなく、静かなマシンなら
206
- より速く出ます。コアを奪い合うものが動いていると両者とも膨らみ、その度合いは一致しません。それが
207
- 並列の列があれだけ動く理由です。秒数そのものが重要なときは、他に負荷のない状態で測り、**実行の
208
- 前後でロードアベレージを記録してください** — その情報が無い数値は、別の数値と比べられません。
282
+ 2026-08-31 に、`rubocop_rubocop` 2693129 / `mastodon_mastodon` b59ddc7 / `Homebrew_brew` b42173b /
283
+ `rails_rails` a19f07f / `ruby_ruby` 22e4a75 の各リビジョンに対して測定しました。
284
+ 1 分平均のロードアベレージは各行の測定時点で 4.5〜7.1 で、その大半は RuboCop 自身の並列
285
+ ワーカーです(計測する以上避けられません)。**アイドル状態ではありません。**
286
+ 各コーパスで両者を連続して同じ条件で測っているため倍率は保たれますが、秒数そのものは下限ではなく、
287
+ 静かなマシンならより速く出ます。コアを奪い合うものが動いていると両者とも膨らみ、その度合いは
288
+ 一致しません。それが並列の列があれだけ動く理由です。秒数そのものが重要なときは、他に負荷のない
289
+ 状態で測り、**実行の前後でロードアベレージを記録してください** — その情報が無い数値は、
290
+ 別の数値と比べられません。
209
291
 
210
292
  ## 開発
211
293
 
@@ -220,8 +302,8 @@ make gem # source gem
220
302
 
221
303
  ### Cop の追加
222
304
 
223
- Cop は `src/rules/<部門>/<cop>.rs` の 1 ファイルで、公開するのは `check(context, offenses)` の
224
- 1 関数だけです。登録は部門の `mod.rs` に 1 行を足します。
305
+ Cop は `src/rules/<デパートメント>/<cop>.rs` の 1 ファイルで、公開するのは
306
+ `check(context, offenses)` の 1 関数だけです。登録はデパートメントの `mod.rs` に 1 行を足します。
225
307
 
226
308
  ```rust
227
309
  department_rules! {
@@ -245,6 +327,12 @@ Cop ごとの全走査はファイル規模ではなく Cop 数に比例して
245
327
  `scripts/sync_default_yml.sh <rubocop-version>` で行い、由来のバージョンがファイル先頭に
246
328
  記録されます。
247
329
 
330
+ `src/display_width_table.rs` も生成物で、コミットします。RuboCop は表示桁を
331
+ `unicode-display_width` gem で数えるため、この表は手書きせず gem から生成しています。
332
+ 手書きの例外表は実際にずれており、NFD 分解された日本語でキャレットの本数が合わなくなっていました。
333
+ 再生成は `ruby scripts/dump_display_width.rb > src/display_width_table.rs` で行い、
334
+ gem と Unicode のバージョンがファイル先頭に記録されます。
335
+
248
336
  依存更新には `depup --install` を使います。Ruby grammar は再現可能性のため `Cargo.toml` で
249
337
  fork のコミットを固定しています。
250
338
 
data/README.md CHANGED
@@ -41,15 +41,76 @@ sonicop --show-cops
41
41
  ```
42
42
 
43
43
  **All 609 RuboCop 1.89 cops are implemented**, matched name for name against the upstream registry.
44
- That is a claim about the registry, not about every configuration: `Style/HashSyntax` is present and
45
- matches everywhere its default reaches, yet none of the four non-default values of its
46
- `EnforcedShorthandSyntax` are implemented. **A cop can be half absent and still match everywhere the
47
- default reaches** — see *Limits* in [CONFORMANCE.md](CONFORMANCE.md).
48
44
  That includes the 159 shipped as `Enabled: pending` and the 56 shipped as `Enabled: false`, which a
49
45
  default run does not reach on either side — name them with `--only` or switch them on in a
50
46
  configuration, exactly as with RuboCop. Unknown cop names still fail validation unless
51
47
  `--ignore-unrecognized-cops` is supplied.
52
48
 
49
+ ### Cop conformance
50
+
51
+ All 609 cops switched on, on both sides, over the 37,491 cases RuboCop's own specs supply, each
52
+ run at the `TargetRubyVersion` its spec asked for. A cop counts as an **exact match** only when its
53
+ offenses agree completely: every position, message, severity and correctable flag, with nothing
54
+ extra on either side.
55
+
56
+ <!-- conformance:start -->
57
+ | Department | Cops | Exercised | Exact match | Diverging |
58
+ |---|---:|---:|---:|---:|
59
+ | Bundler | 7 | 7 | **7 ✓** | 0 |
60
+ | Gemspec | 10 | 10 | **10 ✓** | 0 |
61
+ | Layout | 100 | 100 | 90 | 10 |
62
+ | Lint | 157 | 157 | 147 | 10 |
63
+ | Metrics | 10 | 10 | **10 ✓** | 0 |
64
+ | Migration | 1 | 1 | **1 ✓** | 0 |
65
+ | Naming | 19 | 19 | **19 ✓** | 0 |
66
+ | Security | 7 | 7 | **7 ✓** | 0 |
67
+ | Style | 298 | 298 | 288 | 10 |
68
+ | **Total** | **609** | **609** | **579** | **30** |
69
+ <!-- conformance:end -->
70
+
71
+ **Read the *Exercised* column first.** A cop nothing here made fire contributes neither way — its
72
+ silence is indistinguishable from agreement, so it would be counted as agreement without ever
73
+ being asked. **Every one of the 609 fires here**, which is what makes the *Exact match* column
74
+ mean what it says.
75
+
76
+ Three of them took a run of their own. `Lint/DeprecatedReference`, `Lint/NameTypo` and
77
+ `Lint/UnusedPrivateMethod` report nothing without a `rubydex` project index, which needs the gem
78
+ installed and `AllCops/UseProjectIndex` switched on — and `Lint/DeprecatedReference` needs more
79
+ than that: the call has to sit inside a class inheriting the one whose method carries the
80
+ `@deprecated` tag. Upstream's own specs open with an `expect_no_offenses` saying the cop is silent
81
+ without the index, which is easy to read as "unreachable"; it is not.
82
+
83
+ Getting *Exact match* to 609 while reducing *Diverging* to zero is the current goal. More real Ruby
84
+ does not get there: the 56 cops RuboCop ships disabled, and much of what it ships as pending, never
85
+ fire in a plain run however large the tree. What does reach every one of them is the input its own
86
+ specs supply — the cases recorded in `tests/fixtures/upstream_spec_capture.jsonl` touch **609 of 609
87
+ cops**, measured. Two things about running them are easy to get wrong, and both silently shrink the
88
+ table rather than failing:
89
+
90
+ - **`TargetRubyVersion` is part of the input, not a global.** Pinning everything at 2.7 leaves
91
+ `Style/ArrayIntersect`, `Naming/BlockForwarding`, `Style/ItBlockParameter` and eleven others
92
+ unable to fire at all. Each case is run at the version its spec asked for.
93
+ - **The filename is what several cops inspect.** `Bundler/*` needs a `Gemfile`, `Gemspec/*` a
94
+ `.gemspec`, and `Naming/FileName` reads the name itself. Writing every case as `.rb` had all 17
95
+ of those cops matching nothing.
96
+
97
+ A separate direct oracle sweep on 2026-08-29 examined 11,506 cases extractable from the upstream
98
+ cop specs. RuboCop could not read 226 of those inputs and crashed on one; among the measurable
99
+ cases, Sonicop had **zero detection differences and zero correction differences**. This result is
100
+ not folded into the table above: 51 cops had no directly extractable case, and three directive cops
101
+ cannot be measured under `--only`, so the sweep does not prove that all 609 cops are exact. The
102
+ direct sweep also uses neutral/default conditions rather than preserving every example's
103
+ `TargetRubyVersion`. The four Ruby 3.4-sensitive cops changed in this pass were therefore compared
104
+ separately at 3.4, where their messages and locations matched RuboCop exactly.
105
+
106
+ Configuration is measured separately, because a cop that only matches at its default value is half
107
+ a cop. Every one of the 111 cops carrying an `Enforced*` setting was switched to a **non-default**
108
+ value at once and the corpus re-run: **99.995% of 622,317 offenses match**, with 85 of the 96 cops
109
+ that fired matching exactly. The residue is 10 cops of at most 17 offenses each, plus one where
110
+ RuboCop crashes and sonicop does not; the list is in [CONFORMANCE.md](CONFORMANCE.md).
111
+
112
+ Reproduce either table with `scripts/conformance_table.rb`.
113
+
53
114
  ## Installation
54
115
 
55
116
  ```bash
@@ -99,6 +160,8 @@ run. Local and HTTPS `inherit_from`, `inherit_gem`, `inherit_mode`,
99
160
  `AllCops/DisabledByDefault`, `Include`, and `Exclude`, plus per-cop `Enabled`, `Exclude`,
100
161
  `Severity`, `Safe`, `SafeAutoCorrect`, and cop settings are supported. Cops supplied by declared
101
162
  plugins are accepted as recognized-but-unimplemented without executing Ruby plugin code.
163
+ Remote configuration requests use 30-second network timeouts, and each response is limited to
164
+ 5 MiB.
102
165
 
103
166
  ```yaml
104
167
  inherit_from: .rubocop_todo.yml
@@ -114,22 +177,29 @@ Style/StringLiterals:
114
177
  EnforcedStyle: single_quotes
115
178
  ```
116
179
 
117
- The CLI accepts RuboCop's server/LSP/MCP, plugin, and cache flags to keep existing command lines
118
- parse-compatible. Sonicop does not provide server transports, Ruby plugin execution, cache reuse,
119
- custom Ruby cops, or cops outside the implemented set.
120
-
121
- Most of those flags say so. `--server`, `--no-server`, `--lsp`, `--mcp`, and `--plugin` each print
122
- a one-line notice on stderr. The cache flags print nothing, and only one of them is silent for a
123
- good reason:
124
-
125
- - `--cache=false` asks for no caching, which sonicop already satisfies, so silence is the correct
126
- answer.
127
- - `--cache=true` asks for cache reuse, which sonicop does not provide, and it is silent anyway.
128
-
129
- Cop settings behave like the second case. A setting sonicop does not implement — for example
130
- `EnforcedShorthandSyntax` under `Style/HashSyntax` — is ignored without any warning, and so is a
131
- setting whose name is simply misspelled. **A run that reports no offenses is therefore not evidence
132
- that a setting took effect**, because an ignored setting and a clean file produce the same output.
180
+ The CLI accepts RuboCop's server/LSP/MCP and plugin flags to keep existing command lines
181
+ parse-compatible. Sonicop does not provide server transports, Ruby plugin execution, custom Ruby
182
+ cops, or cops outside the implemented set. Each of those flags says so: `--server`, `--no-server`,
183
+ `--lsp`, `--mcp`, and `--plugin` print a one-line notice on stderr.
184
+
185
+ The cache flags are honoured rather than merely parsed. Sonicop keeps a result cache of its own and
186
+ serves a stored report for a file whose size, modification time and permission bits have not moved
187
+ since it was inspected.
188
+
189
+ - Caching is on by default. `--cache false` turns it off, as does `AllCops/MaxFilesInCache: 0` in a
190
+ configuration file.
191
+ - `--cache-root DIR` chooses where it lives. Without it the root is `$XDG_CACHE_HOME/sonicop`, or
192
+ `~/Library/Caches/sonicop` on macOS, or `~/.cache/sonicop`. `--cache-root` cannot be combined
193
+ with `--cache false`.
194
+ - `AllCops/MaxFilesInCache` bounds how many reports are kept, defaulting to RuboCop's 20,000.
195
+ - Autocorrect runs, `--stdin`, `--profile` and `--memory` neither read nor write it.
196
+ - It is not shared with RuboCop's cache: the formats are unrelated, and an entry is only served back
197
+ to a build of Sonicop identical to the one that wrote it.
198
+
199
+ Cop settings are the silent case. A setting sonicop does not implement is ignored without
200
+ any warning, and so is a setting whose name is simply misspelled. **A run that reports no offenses
201
+ is therefore not evidence that a setting took effect**, because an ignored setting and a clean file
202
+ produce the same output. *Cop conformance* above says which values have been measured.
133
203
 
134
204
  Cop *names* are checked: an unrecognised cop in a configuration file stops the run with an error.
135
205
  It is the settings inside a recognised cop that pass unvalidated.
@@ -146,9 +216,12 @@ Mastodon (15,286), with no excess, no shortfall and no metadata differences. The
146
216
  match exactly on all five — paths, not just counts, compared as sets. What remains is concentrated in
147
217
  `Lint/Syntax`. Most of it is RuboCop's
148
218
  LALR parser recovering from an error and emitting diagnostics a tree-sitter parse cannot
149
- reconstruct — that direction accounts for the shortfall. **The excess is a separate question and has
150
- not been investigated**; on Homebrew all 263 of it is `Lint/Syntax` too, but what Sonicop calls a
151
- syntax error there and RuboCop does not is unexamined.
219
+ reconstruct, and the resulting position differences go in both directions. On Homebrew all 997
220
+ missing and 263 excess positions are `Lint/Syntax`, but the **sets of files rejected as syntax
221
+ errors are exactly the same: 569 versus 569**, with no file rejected only by Sonicop. The 263 excess
222
+ positions occur in 135 shared syntax-error files and every one follows a diagnostic at a position
223
+ shared by both tools, so they are recovery-position differences rather than a separate acceptance
224
+ bug. At Ruby 3.1, which supports the syntax used there, both tools report zero `Lint/Syntax` offenses.
152
225
  Autocorrect is byte-identical on RuboCop's own tree and on Mastodon, the two corpora held as a hard
153
226
  line: a change that breaks byte equality there is a regression, not a new known divergence.
154
227
 
@@ -169,50 +242,62 @@ once the 159 RuboCop ships as `Enabled: pending` and the 56 it ships as `Enabled
169
242
  aside; a default run reaches neither group on either side.) Times are the fastest of two
170
243
  warmed runs.
171
244
 
172
- | Corpus | Files | RuboCop parallel | Sonicop parallel | RuboCop single | Sonicop single |
173
- |---|---:|---:|---:|---:|---:|
174
- | rubocop/rubocop | 1,765 | 12.71 s | **4.59 s** | 42.74 s | **13.75 s** |
175
- | mastodon/mastodon | 3,290 | 29.95 s | **6.48 s** | 37.60 s | **15.88 s** |
176
- | Homebrew/brew | 2,179 | 18.20 s | **4.31 s** | 38.72 s | **11.67 s** |
177
- | rails/rails | 3,551 | 52.55 s | **16.88 s** | 162.55 s | **63.97 s** |
178
- | ruby/ruby | 7,466 | 132.17 s | **43.10 s** | 199.78 s | **76.07 s** |
245
+ | Corpus | Files | Offenses | RuboCop parallel | Sonicop parallel | RuboCop single | Sonicop single |
246
+ |---|---:|---:|---:|---:|---:|---:|
247
+ | rubocop/rubocop | 1,780 | 5,826 | 10.85 s | **1.53 s** | 41.44 s | **8.96 s** |
248
+ | mastodon/mastodon | 3,292 | 15,293 | 22.59 s | **3.04 s** | 34.74 s | **6.86 s** |
249
+ | Homebrew/brew | 2,296 | 51,527 | 13.56 s | **2.21 s** | 40.36 s | **6.51 s** |
250
+ | rails/rails | 3,562 | 168,615 | 32.90 s | **8.84 s** | 85.71 s | **19.17 s** |
251
+ | ruby/ruby | 7,477 | 765,975 | 86.89 s | **15.59 s** | 193.59 s | **37.98 s** |
179
252
 
180
- The gap is 2.8x to 4.6x in parallel and 2.4x to 3.3x single-process, so no single corpus summarizes
253
+ The gap is 3.7x to 7.4x in parallel and 4.5x to 6.2x single-process, so no single corpus summarizes
181
254
  it. **Read the single-process column and treat the parallel one as indicative.** Measuring the same
182
255
  two binaries three times over a day put the single-process figures within 16% of each other every
183
256
  time, while the parallel ratio on RuboCop's own tree moved between 3.3x and 9.2x purely with what
184
257
  else the machine was doing. Single-process measures the engines; parallel measures the engines plus
185
258
  how well each one's scheduling happens to fit that tree on that run.
186
259
 
187
- The speed is not bought by skipping work: over those same 394 cops the two agree on **every offense**
188
- on RuboCop's own tree, on Rails and on Mastodon — 188,812 offenses with nothing on either side of the
189
- ledger — and autocorrect is byte-identical on the first and the last.
260
+ The speed is not bought by skipping work. Over those same 394 cops the two find the **same number of
261
+ offenses** on every corpus in the table, and on RuboCop's own tree and on Mastodon every one of them
262
+ is at the same position with the same message and severity. Rails, at 168,615 offenses, differs in
263
+ two of them — one `Style/CaseLikeIf` Sonicop reports and one `Metrics/AbcSize` it does not — and
264
+ RuboCop's own tree differs in one offense's `correctable` flag. Autocorrect is byte-identical on the
265
+ first and the last.
190
266
 
191
- Two details matter for reproducing this. RuboCop **silently turns `--parallel` off when combined
267
+ Four details matter for reproducing this. RuboCop **silently turns `--parallel` off when combined
192
268
  with `--cache false`**, so its parallel runs here use a cache directory that is deleted before each
193
269
  run rather than disabled; timing it with `--cache false --parallel` measures a single process and
194
270
  overstates the difference. RuboCop's default is a single process, while Sonicop is parallel unless
195
- `--no-parallel` is passed.
271
+ `--no-parallel` is passed. Both sides need a **cold** cache: Sonicop caches by default too, so a
272
+ second run over the same tree answers from its own cache and measures nothing about the engine —
273
+ give each tool a throwaway cache root. And the cache root must be a **real path**: macOS `mktemp -d`
274
+ returns `/var/folders/…`, whose `/var` is a symlink, and RuboCop refuses such a location and runs
275
+ with no cache at all.
196
276
 
197
277
  ```bash
198
278
  # RuboCop, parallel, cold cache, its full default set of 394 cops
199
- rubocop --force-default-config --cache true --cache-root "$(mktemp -d)" \
279
+ root=$(mktemp -d /private/tmp/bench.XXXXXX)
280
+ rubocop --force-default-config --cache true --cache-root "$root" \
200
281
  --no-color --parallel -f quiet
201
282
 
202
- # Sonicop
203
- sonicop --force-default-config --format quiet
283
+ # Sonicop, cold cache
284
+ sonicop --force-default-config --cache-root "$root" --format quiet
204
285
  ```
205
286
 
287
+ Writing the cache is part of these numbers, and it is not free: the index holds every offense with
288
+ the source line it was found on, which is 336 MB over `ruby/ruby`. A second run against a warm cache
289
+ answers in 1.59 s there, and in 0.42 s over Rails.
290
+
206
291
  Machine: Apple M2 (8 cores), Ruby 4.0.6 with YJIT available, RubyGems-installed RuboCop 1.89.0.
207
- The one-minute load average was 4.0 when the run started and 3.1 when it finished — the machine was
208
- in use, not idle. RuboCop's own tree was re-measured on its own afterwards, at load 3.7 rising to 4.0,
209
- because the first pass over it ran while a release build was still finishing and its numbers came out
210
- 60% high; a row measured under a different load cannot sit in the same table as the others. Both tools
211
- ran under the same conditions, so the ratios hold, but the absolute
212
- seconds are not a floor: expect better on a quiet machine. Anything competing for cores inflates
213
- both sides, and not by the same factor on each, which is what makes the parallel column move as much
214
- as it does. If the absolute numbers matter to you, measure on an idle machine and record the load
215
- either side of the run — a figure without that context cannot be compared with another one.
292
+ Measured on 2026-08-31 against the corpora at `rubocop_rubocop` 2693129, `mastodon_mastodon` b59ddc7,
293
+ `Homebrew_brew` b42173b, `rails_rails` a19f07f and `ruby_ruby` 22e4a75. The one-minute load average
294
+ was between 4.5 and 7.1 as each row was taken — most of it RuboCop's own parallel workers, which is
295
+ inherent to measuring them. **The machine was in use, not idle.** Both tools ran back to back under
296
+ the same conditions on each corpus, so the ratios hold, but the absolute seconds are not a floor:
297
+ expect better on a quiet machine. Anything competing for cores inflates both sides, and not by the
298
+ same factor on each, which is what makes the parallel column move as much as it does. If the
299
+ absolute numbers matter to you, measure on an idle machine and record the load either side of the
300
+ run — a figure without that context cannot be compared with another one.
216
301
 
217
302
  ## Development
218
303
 
@@ -254,6 +339,13 @@ fails when the two disagree.
254
339
  `scripts/sync_default_yml.sh <rubocop-version>`, which records the source version in the file
255
340
  header.
256
341
 
342
+ `src/display_width_table.rs` is generated and committed too. RuboCop measures display columns with
343
+ the `unicode-display_width` gem, so the table is taken from the gem rather than restated by hand —
344
+ an exception table written out by hand had already drifted far enough to draw the wrong number of
345
+ carets under decomposed Japanese. Regenerate it with
346
+ `ruby scripts/dump_display_width.rb > src/display_width_table.rs`, which records the gem and Unicode
347
+ versions in the file header.
348
+
257
349
  Dependencies are updated with `depup --install`. The Ruby grammar dependency is pinned to an exact
258
350
  fork commit in `Cargo.toml` for reproducible builds.
259
351
 
@@ -15,7 +15,13 @@ module Sonicop
15
15
  MESSAGE
16
16
 
17
17
  begin
18
- exec(binary, *arguments)
18
+ # `[binary, binary]` = exec 形式の強制。`exec(binary, *arguments)` は arguments が空、
19
+ # つまり「カレントディレクトリを見る素の `sonicop`」という最も普通の呼び出しのとき
20
+ # `exec(String)` = commandline 形式に落ちる。この形式は空白で単語分割し、メタ文字が
21
+ # あればまるごと /bin/sh に渡すため、binary のパス次第で ENOENT や exit 127 になる。
22
+ # パスの出所は SONICOP_BINARY と gem の install 先で、どちらもメタ文字を含まない保証がない。
23
+ # argv0 は multi-arg 形式が既定で入れるものと同じ値を明示している。
24
+ exec([binary, binary], *arguments)
19
25
  rescue SystemCallError => error
20
26
  # 実行できない典型は「platform gem は入ったが実行環境と ABI が違う」ケース
21
27
  # (musl 環境に glibc ビルドが入るなど)。素の errno だけでは原因が読めない。
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Generated from Cargo.toml by `rake version:sync`. Do not edit by hand.
4
4
  module Sonicop
5
- VERSION = '26.8.111'
5
+ VERSION = '26.8.113'
6
6
  end
data/libexec/sonicop CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sonicop
3
3
  version: !ruby/object:Gem::Version
4
- version: 26.8.111
4
+ version: 26.8.113
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Yohei