1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
|
# RuboCop config for raylib-jamstack.
#
# Game code is mruby 3.3 (a subset of Ruby 3.3); the mrbgem mrblib/ sugar and
# the tools/ generators run on the host MRI 3.4.8 that runs RuboCop itself.
# RuboCop runs ON MRI but ANALYZES code targeting any Ruby version — setting
# TargetRubyVersion: 3.4 makes the parser accept mruby's endless methods
# (`def foo = expr`, Ruby 3.0+ syntax) without false "unexpected token tEQL"
# syntax errors. (The upstream mruby repo uses the same TargetRubyVersion: 3.4
# in its own .rubocop.yml.)
#
# Pattern: DisabledByDefault + enable whole departments (Layout, Lint) +
# a curated Style subset. This mirrors the upstream mruby repo's approach
# (DisabledByDefault: true — they enable only 3 layout cops; we enable more but
# the principle is identical: opt-in, never the full default set). Cops that
# suggest MRI-only stdlib methods (Performance/*, some Style/* like FetchEnvVar)
# are NOT enabled — they'd false-positive on mruby's smaller stdlib.
#
# Run manually: bin/lint (report only)
# bin/lint --fix (safe autocorrect layout/lint)
# Run directly: rubocop (report) / rubocop -a (safe autocorrect)
#
# See .agents/knowledge/linting.md for the full rationale + how it fits with
# the LSP/Steep setup (linting is MANUAL; syntax errors are caught at build time
# by the mruby-compiler gem; type errors by Steep per-edit).
AllCops:
DisabledByDefault: true
TargetRubyVersion: 3.4
NewCops: disable
Exclude:
- 'vendor/**/*' # vendored mruby/raylib/rmlui/flecs/joltc sources
- 'build/**/*' # mruby build outputs
- 'zig-out/**/*' # zig build outputs
- '.cache/**/*' # transient caches
- '.live/**/*' # runtime agent-bridge mount (dev-only)
- '.ruby-lsp/**/*' # ruby-lsp's private bundle
- 'steep-2.0.0.gem' # vendored steep gem (not Ruby source)
# ─── Layout: whole department — pure syntax (spacing/indentation), mruby-safe ─
# Layout cops carry NO runtime assumptions; they're safe for mruby. Aligned with
# the existing 2-space-indent, ~100-col style.
Layout:
Enabled: true
Layout/EndOfLine:
EnforcedStyle: lf
Layout/IndentationStyle:
EnforcedStyle: spaces
Layout/IndentationWidth:
Width: 2
Layout/LineLength:
Max: 100
AllowedPatterns: ['\A\s*#'] # long comment lines OK
# ─── Lint: whole department — real bug-finders, runtime-safe ──────────────────
# Catches duplicated hash keys, useless assignments, ambiguous operators, etc.
# These are valuable and don't assume MRI stdlib.
Lint:
Enabled: true
# The game loop and bridge intentionally rescue Exception (not StandardError) to
# keep the game running / log exceptions instead of crashing. This is a
# deliberate pattern across mrbgems/*/mrblib/ (raylib.rb, live.rb, hot.rb).
Lint/RescueException:
Enabled: false
# ─── Style: curated safe subset (no MRI-stdlib suggestions) ───────────────────
# DisabledByDefault means Style is off entirely; we opt into specific cops that
# are purely syntactic / conventional. Deliberately NOT enabled: cops that
# suggest MRI-only behavior — Style/FetchEnvVar, Style/EnvHome, Style/OpenStructUse,
# Style/Documentation (game scripts are un-annotated),
# Style/FrozenStringLiteralComment (mruby ignores it; noise).
Style/AndOr:
Enabled: true
Style/BlockDelimiters:
Enabled: true
Style/ClassCheck:
Enabled: true
Style/ColonMethodCall:
Enabled: true
Style/ColonMethodDefinition:
Enabled: true
Style/CommandLiteral:
Enabled: true
Style/CommentAnnotation:
Enabled: true
Style/DefWithParentheses:
Enabled: true
Style/DoubleNegation:
Enabled: true
Style/EachForSimpleLoop:
Enabled: true
Style/EmptyElse:
Enabled: true
Style/EmptyLiteral:
Enabled: true
Style/EmptyMethod:
Enabled: true
Style/EndlessMethod:
Enabled: true
EnforcedStyle: allow_single_line
Style/EvalWithLocation:
Enabled: true
Style/EvenOdd:
Enabled: true
Style/For:
Enabled: true
Style/FormatString:
Enabled: true
Style/FormatStringToken:
Enabled: true
Style/GuardClause:
Enabled: true
Style/HashSyntax:
Enabled: true
Style/IdenticalConditionalBranches:
Enabled: true
Style/IfInsideElse:
Enabled: true
Style/IfUnlessModifier:
Enabled: true
Style/IfUnlessModifierOfIfUnless:
Enabled: true
Style/InfiniteLoop:
Enabled: true
Style/KeywordParametersOrder:
Enabled: true
Style/Lambda:
Enabled: true
Style/LambdaCall:
Enabled: true
Style/LineEndConcatenation:
Enabled: true
Style/MethodCallWithoutArgsParentheses:
Enabled: true
Style/MethodCalledOnDoEndBlock:
Enabled: true
Style/MethodDefParentheses:
Enabled: true
Style/MinMax:
Enabled: true
Style/MultilineBlockChain:
Enabled: true
Style/MultilineIfModifier:
Enabled: true
Style/MultilineIfThen:
Enabled: true
Style/MultilineMemoization:
Enabled: true
Style/MultilineMethodSignature:
Enabled: true
Style/MultilineTernaryOperator:
Enabled: true
Style/MultilineWhenThen:
Enabled: true
Style/MultipleComparison:
Enabled: true
Style/MutableConstant:
Enabled: true
Style/NegatedIf:
Enabled: true
Style/NegatedUnless:
Enabled: true
Style/NegatedWhile:
Enabled: true
Style/NestedModifier:
Enabled: true
Style/NestedParenthesizedCalls:
Enabled: true
Style/NestedTernaryOperator:
Enabled: true
Style/Next:
Enabled: true
Style/NilComparison:
Enabled: true
Style/NonNilCheck:
Enabled: true
Style/Not:
Enabled: true
Style/NumericLiteralPrefix:
Enabled: true
Style/NumericLiterals:
Enabled: true
Style/NumericPredicate:
Enabled: true
Style/OneLineConditional:
Enabled: true
Style/OptionalArguments:
Enabled: true
Style/OrAssignment:
Enabled: true
Style/ParallelAssignment:
Enabled: true
Style/ParenthesesAroundCondition:
Enabled: true
Style/PercentLiteralDelimiters:
Enabled: true
Style/PercentQLiterals:
Enabled: true
Style/PerlBackrefs:
Enabled: true
Style/PreferredHashMethods:
Enabled: false # suggests MRI Hash methods — mruby-safe to leave off
Style/Proc:
Enabled: true
Style/QuotedSymbols:
Enabled: true
Style/RaiseArgs:
Enabled: true
Style/RandomWithOffset:
Enabled: true
Style/RedundantBegin:
Enabled: true
Style/RedundantConditional:
Enabled: true
Style/RedundantException:
Enabled: true
Style/RedundantFetchBlock:
Enabled: true
Style/RedundantFreeze:
Enabled: true
Style/RedundantInterpolation:
Enabled: true
Style/RedundantParentheses:
Enabled: true
Style/RedundantRegexpCharacterClass:
Enabled: true
Style/RedundantRegexpEscape:
Enabled: true
Style/RedundantReturn:
Enabled: true
Style/RedundantSelf:
Enabled: true
Style/RedundantSelfAssignment:
Enabled: true
Style/RedundantSelfAssignmentBranch:
Enabled: true
Style/RedundantSort:
Enabled: true
Style/RedundantSortBy:
Enabled: true
Style/RedundantStringEscape:
Enabled: true
Style/RegexpLiteral:
Enabled: true
Style/RescueModifier:
Enabled: true
Style/RescueStandardError:
Enabled: true
Style/SafeNavigation:
Enabled: true
Style/Sample:
Enabled: true
Style/SelfAssignment:
Enabled: true
Style/Semicolon:
Enabled: true
Style/SendWithLiteralMethodName:
Enabled: true
Style/SignalException:
Enabled: true
Style/SingleLineMethods:
Enabled: true
Style/SlicingWithRange:
Enabled: true
Style/SoleNestedConditional:
Enabled: true
Style/SpecialGlobalVars:
Enabled: true
Style/StabbyLambdaParentheses:
Enabled: true
Style/StderrPuts:
Enabled: true
Style/StringChars:
Enabled: true
Style/StringConcatenation:
Enabled: true
Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
Style/StringLiteralsInInterpolation:
Enabled: true
EnforcedStyle: double_quotes
Style/StructInheritance:
Enabled: true
Style/SuperArguments:
Enabled: true
Style/SwapValues:
Enabled: true
Style/SymbolArray:
Enabled: true
Style/SymbolLiteral:
Enabled: true
Style/SymbolProc:
Enabled: true
Style/TernaryParentheses:
Enabled: true
Style/TrailingBodyOnClass:
Enabled: true
Style/TrailingBodyOnMethodDefinition:
Enabled: true
Style/TrailingBodyOnModule:
Enabled: true
Style/TrailingCommaInArguments:
Enabled: true
Style/TrailingCommaInArrayLiteral:
Enabled: true
Style/TrailingCommaInHashLiteral:
Enabled: true
Style/TrailingMethodEndStatement:
Enabled: true
Style/TrivialAccessors:
Enabled: true
Style/UnlessElse:
Enabled: true
Style/VariableInterpolation:
Enabled: true
Style/WhenThen:
Enabled: true
Style/WhileUntilDo:
Enabled: true
Style/WhileUntilModifier:
Enabled: true
Style/WordArray:
Enabled: true
Style/YodaCondition:
Enabled: true
Style/ZeroLengthPredicate:
Enabled: true
# ─── Explicitly DISABLED: "too many lines" / size cops ────────────────────────
# These complain about methods/blocks/modules/classes being too long. Game code
# + mrbgem sugar intentionally has long methods and large files; these cops
# would generate noise without catching real bugs. DisabledByDefault already
# leaves Metrics off; these are explicit so they never fire even if that flag
# is later flipped. (Note: Metrics/FileLength does not exist in RuboCop 1.88.)
Metrics/MethodLength:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
# Other Metrics cops (complexity, not strictly "lines") — disabled too, since
# they're in the same "your code is too big/complex" family.
Metrics/AbcSize:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Metrics/BlockNesting:
Enabled: false
Metrics/ParameterLists:
Enabled: false
Metrics/CollectionLiteralLength:
Enabled: false
|