-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.golangci.yml
More file actions
730 lines (726 loc) · 26.8 KB
/
Copy path.golangci.yml
File metadata and controls
730 lines (726 loc) · 26.8 KB
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
version: "2"
run:
timeout: 5m
linters:
default: none
enable:
# Correctness.
- errcheck
- govet
- ineffassign
- staticcheck
- unused
- bodyclose
- copyloopvar
- errorlint
- nilerr
- noctx
- rowserrcheck
- sqlclosecheck
# Style and clarity.
- gocritic
- gocyclo
- gocognit
- misspell
- nakedret
- nolintlint
- prealloc
- revive
- unconvert
- unparam
- whitespace
- usestdlibvars
# Security.
- gosec
settings:
errcheck:
exclude-functions:
- fmt.Fprint
- fmt.Fprintf
- fmt.Fprintln
- (*os.File).Close
gocyclo:
min-complexity: 20
gocognit:
min-complexity: 30
gocritic:
enabled-tags:
- diagnostic
- performance
- style
disabled-checks:
# Comments without leading space are common in C-mirrored
# code.
- commentFormatting
# We carry deliberate var-name parity with CPython where it
# helps readability of the port.
- paramTypeCombine
# Multi-return functions in C-mirrored code rarely benefit
# from named results; the upstream signatures use positional
# returns and the Go callers immediately destructure.
- unnamedResult
revive:
rules:
- name: var-naming
# package-comments and exported are disabled because the
# CPython-parity header style (citing the upstream file at
# the top of every .go) does not start with "Package <name>"
# and the rule fires per file rather than per package.
- name: error-return
- name: error-naming
- name: if-return
- name: increment-decrement
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: empty-block
- name: redefines-builtin-id
- name: superfluous-else
- name: unreachable-code
# unused-parameter is disabled because the dispatch-table
# function signatures carry shared shape (e.g. `ts *Thread`)
# for trait conformance even when a particular handler does
# not need the value.
- name: var-declaration
misspell:
locale: US
# CPython's compile() raises "unrecognised flags" with the British
# spelling; we keep the error text byte-for-byte for parity.
ignore-rules:
- unrecognised
- recognised
gosec:
excludes:
# uint32 -> uint8 narrowing is intentional in pysync byte-flag
# mutex words; sync/atomic has no Uint8.
- G115
# unsafe.Pointer is required for address-keyed parking and
# the byte-flag mutex word identity.
- G103
nakedret:
max-func-lines: 1
nolintlint:
require-explanation: true
require-specific: true
allow-unused: false
exclusions:
rules:
- path: _test\.go
linters:
- gosec
- errcheck
- gocyclo
- gocognit
- unparam
- revive
# PyExc_* singletons keep CPython's exact spelling for source-shape
# parity; the underscore is part of the public API contract.
- path: errors/builtins\.go
linters:
- revive
- path: errors/exc_.*\.go
linters:
- revive
# NB_* / MIN_* constants mirror CPython's BINARY_OP sub-opcode and
# opcode-range enums byte for byte. The spelling is the parity
# contract with Include/opcode.h.
- path: compile/codegen_expr_op\.go
linters:
- revive
# eval_dispatch_handwritten.go and eval_dispatch_gen.go keep
# CPython's opXXX_YYY / opXXX naming for opcode-handler methods so
# the dispatch table reads against bytecodes.c case-for-case.
# QF1011 fires on interface-typed vars that hold alternating concrete
# types (None/concrete); the explicit type annotation is required.
- path: vm/eval_dispatch_handwritten\.go
linters:
- revive
- gocritic
- staticcheck
- path: vm/eval_dispatch_gen\.go
linters:
- revive
- gocritic
- path: compile/instrseq\.go
linters:
- revive
# forceInstrument and BuildSysMonitoring mirror CPython's
# _Py_Instrument and the sys.monitoring builtin wiring; their
# branch tree is the parity unit with Python/instrumentation.c.
- path: monitor/install\.go
linters:
- gocognit
- gocyclo
- path: monitor/sysmonitoring\.go
linters:
- gocognit
- gocyclo
# specializeAt fans out to every adaptive opcode arm; the switch
# matches Python/specialize.c's per-opcode dispatch shape.
- path: vm/adaptive\.go
linters:
- gocognit
- gocyclo
# format.FormatString/FormatInt/FormatFloat mirror CPython's
# format_*_internal entry points; the parity is part of the spec
# so the "name stutters" advice does not apply.
- path: format/format\.go
text: "format\\.Format(String|Int|Float).*stutters"
linters:
- revive
# ParseUint mirrors mystrtoul.c line-for-line; collapsing the
# nested switches would diverge from the source shape.
- path: pystrconv/strtoul\.go
linters:
- gocognit
- gocyclo
# Code generators read CPython source paths from CLI flags and
# write to checked-in output files; standard gosec heuristics
# for file inclusion / permissions do not apply.
- path: Tools/
linters:
- gosec
- gocritic
- gocognit
- gocyclo
- prealloc
- staticcheck
- noctx
- errorlint
- misspell
# pythonrun.RunFile is the port of PyRun_AnyFileExFlags: reading a
# caller-supplied path is the entire contract, so G304 does not
# apply.
- path: pythonrun/runfile\.go
linters:
- gosec
# imp/loader.go is the port of SourceFileLoader / SourcelessFileLoader:
# reading caller-supplied module file paths is the entire contract.
- path: imp/loader\.go
linters:
- gosec
# FindEncodingFilename is the port of _PyTokenizer_FindEncodingFilename:
# opening a caller-supplied source path is the entire contract.
- path: parser/lexer/driver_file\.go
linters:
- gosec
# FormatInt and ParseSpec mirror format_long_internal /
# parse_internal_render_format_spec; the branch tree matches
# CPython's switch and is the unit of parity.
- path: format/format\.go
linters:
- gocognit
- gocyclo
# The lexer FSM mirrors tok_get_normal_mode and tok_get_fstring_mode
# branch-for-branch. Refactoring would diverge from the source. The
# helper return types mirror _PyTokenizer_* C return shapes (unparam),
# and the nested-option FSM resists switch collapse (gocritic).
- path: parser/lexer/
linters:
- gocognit
- gocyclo
- gocritic
- unparam
# The string-literal parser mirrors string_parser.c's branch
# tree on the prefix and escape decoding paths.
- path: parser/string/
linters:
- gocognit
- gocyclo
# builtin_print_impl carries CPython's surface for print():
# file/sep/end/flush kwargs plus the per-arg loop. The branch
# tree mirrors Python/bltinmodule.c.
- path: builtins/print\.go
linters:
- gocognit
- gocyclo
# calculateStackdepth ports Python/flowgraph.c branch tree.
# Collapsing it would diverge from the source shape.
- path: compile/flowgraph_stackdepth\.go
linters:
- gocognit
- gocyclo
# buildConcatenatedStr ports the string-folding branch tree
# from Parser/action_helpers.c.
- path: parser/pegen/extras\.go
linters:
- gocognit
- gocyclo
# ConfigParseCmdline mirrors config_parse_cmdline's switch
# statement from Python/initconfig.c, and the getopt iterator
# mirrors _PyOS_GetOpt's branch tree from Python/getopt.c.
# Collapsing the cases would diverge from the source shape.
- path: initconfig/config_cli\.go
linters:
- gocognit
- gocyclo
- path: initconfig/getopt\.go
linters:
- gocognit
- gocyclo
# mergeLo / mergeHi / Sort port the TimSort merge loops from
# Objects/listobject.c branch-for-branch; collapsing them would
# diverge from the upstream algorithm.
- path: objects/list_sort\.go
linters:
- gocognit
- gocyclo
# strSplitWhitespace mirrors stringlib_split_whitespace plus its
# rsplit twin; the dual-direction loop tree is the unit of parity.
- path: objects/str_methods\.go
linters:
- gocognit
- gocyclo
# twoWay / defaultFind / adaptiveFind port Objects/stringlib/fastsearch.h
# FASTSEARCH branch-for-branch (Boyer-Moore-Horspool plus the Two-Way
# escalation). The bound checks like `i+1 <= w` mirror the C index
# arithmetic exactly, so collapsing them would diverge from the source.
- path: objects/stringlib_fastsearch\.go
linters:
- gocognit
- gocyclo
- gocritic
# bytesFormat ports _PyBytes_FormatEx from Objects/bytesobject.c: the
# big per-conversion switch is the parity unit with CPython.
- path: objects/bytes_format\.go
linters:
- gocognit
- gocyclo
# bytearray.go's init() wires the full bytearray method/getset table in
# one block, and byteArrayAssSubscript mirrors bytearray_ass_subscript
# (Objects/bytearrayobject.c) branch-for-branch across the single-index
# and slice (simple + extended step) assignment and deletion cases. The
# complexity is the parity surface, not collapsible branching.
- path: objects/bytearray\.go
linters:
- gocognit
- gocyclo
# translateMethod and hexMethod mirror bytes_translate_impl and
# bytes_hex_impl from Objects/bytesobject.c branch-for-branch; the
# nested option/sep parsing and per-byte loop are the parity unit.
# hexSepByte carries the _Py_strhex_impl separator messages verbatim
# ("sep must be length 1.", "sep must be ASCII.") from Python/pystrhex.c,
# which end with periods, so ST1005 does not apply.
- path: objects/bytes_methods_descr\.go
linters:
- gocognit
- gocyclo
- staticcheck
# funcTpNew mirrors func_new_impl from Objects/funcobject.c: the
# six positional+keyword arguments each carry typed validation
# branches that match the upstream signature one-for-one.
# G602 (gosec) fires on slice indexing that CPython does with a
# bounds-checked C array; the Go indexing is equivalent and safe.
- path: objects/function\.go
linters:
- gocognit
- gocyclo
- gosec
# PyUnicode_Format dispatches one big switch on the conversion
# character; that's the upstream shape.
- path: objects/str_modulo\.go
linters:
- gocognit
- gocyclo
# Code.Replace mirrors the code_replace switch on attribute name.
# The CodeReplace struct is the call-site shape (a builder), so
# passing it by value is the API contract.
- path: objects/code\.go
linters:
- gocritic
- gocyclo
- gocognit
# fileMethod mirrors PyFile_Type's tp_methods dispatch table:
# one big attribute-name switch is the parity unit with CPython
# Objects/fileobject.c.
- path: objects/file\.go
linters:
- gocyclo
- gocognit
# builtins.Init wires every built-in into the dict; the size
# mirrors the surface, not algorithmic complexity.
- path: builtins/init\.go
linters:
- gocognit
- gocyclo
# sys.buildModule wires every sys attribute into the dict; the
# size mirrors the surface (Python/sysmodule.c), not complexity.
- path: module/sys/module\.go
linters:
- gocognit
- gocyclo
# sys.Init mirrors _PySys_InitCore: the long setStr/setInt chain
# is the parity unit with the upstream initializer, not algorithmic
# branching.
- path: module/sys/sys\.go
linters:
- gocognit
- gocyclo
# Pegen scaffolding has many helpers held for the generated
# parser table; flagging them as unused now would force ugly
# nolint stamps everywhere. Re-enabled once parser_gen lands.
# action_helpers_gen.go is machine-generated; its raiseAction and
# string helpers carry the shape of the generator output, not hand
# tunable complexity. ineffassign catches intermediate vars that
# the generator emits verbatim from the grammar. staticcheck
# QF1003/SA4006 fire on generated branching that mirrors the
# grammar production shape.
- path: parser/pegen/
linters:
- unused
- gocognit
- gocyclo
- gocritic
- ineffassign
- staticcheck
- prealloc
# vm/eval_helpers.go is the helper pool the bytecodes_gen
# translator draws from. We keep helpers ported but not yet
# referenced by an instrumented opcode body. Same pattern as
# parser/pegen scaffolding.
- path: vm/eval_helpers\.go
linters:
- unused
# monitorRaise / monitorReraise mirror _PyEval_MonitorRaise and
# monitor_reraise. They are picked up once RERAISE / ERROR_NO_POP
# arms wire them through the translator (next A6 batch).
- path: vm/instrument_monitor_exc\.go
linters:
- unused
# loadMethodCacheView dictOffset accessors mirror LOAD_METHOD's
# adaptive cache layout from Python/specialize.c; the setter is
# invoked once specialize_load_method lands.
- path: specialize/cache_views\.go
linters:
- unused
# Lexer scaffolding holds helpers consumed once the file driver
# and action_helpers ports land.
- path: parser/lexer/buffer\.go
linters:
- unused
- path: parser/lexer/helpers\.go
linters:
- unused
- path: parser/lexer/state\.go
linters:
- unused
- path: parser/lexer/token\.go
linters:
- unused
# Tier-2 optimizer scaffolding. has_space_for_executor /
# get_index_for_executor / insert_executor / executorDetach are
# called by Optimize once executor.go and optimize.go land
# (tasks #437, #439).
- path: optimizer/side_table\.go
linters:
- unused
# The lattice's per-tag switches mirror optimizer_symbols.c
# branch-for-branch; collapsing them would diverge from the
# source shape and break the gate fixtures.
- path: optimizer/symbols\.go
linters:
- gocyclo
- gocognit
- gocritic
# TranslateBytecodeToTrace mirrors optimizer.c's
# translate_bytecode_to_trace branch-for-branch; the per-opcode
# switch and the inlined macro-expansion loop are the unit of
# parity with CPython.
- path: optimizer/trace\.go
linters:
- gocognit
- gocyclo
# removeGlobals tracks optimizer_analysis.c case-for-case; the
# branch shape is the unit of parity. The unsafe.Pointer cast
# mirrors the C uintptr-as-PyObject* round-trip.
- path: optimizer/analysis\.go
linters:
- gocognit
- gocyclo
- gosec
- govet
# cases_generator/lexer.py and parsing.py shape: keeping the
# Token value type, the master regex builder, and the recursive
# descent functions verbatim is the parity discipline. Token
# is intentionally a value because lexer.py treats it as one.
- path: Tools/uops_gen/(lexer|parsing|plexer|cwriter|analyzer|stack|generators_common|tier2_generator|optimizer_generator)\.go
linters:
- gocritic
- gocognit
- gocyclo
- prealloc
- path: Tools/uops_gen/lexer_test\.go
linters:
- gocritic
- errorlint
# The _io module dispatch methods (bytesIOMethod, fileIOMethod,
# textIOWrapperMethod) mirror _io.c's tp_methods dispatch table:
# one big attribute-name switch is the parity unit with CPython.
- path: module/io/
linters:
- gocognit
- gocyclo
- gocritic
# fileIOModeFlags mirrors the mode-parsing switch in
# Modules/_io/fileio.c; collapsing it would diverge from CPython.
# OpenFile with a caller-supplied path is the entire contract of FileIO.
- path: module/io/fileio\.go
linters:
- gocyclo
- gosec
# statSysFields returns the 7-field Stat_t breakdown matching
# CPython's posixmodule.c stat result tuple fields. The named-return
# pattern mirrors the C struct layout; naked returns are intentional.
- path: module/os/stat_
linters:
- gocritic
- nakedret
# os.module.go mirrors posixmodule.c's large dispatch table.
# makedirs uses 0o777 to match Python's os.makedirs default (umask trims it).
- path: module/os/module\.go
linters:
- gocognit
- gocyclo
- gosec
# zlib.module.go mirrors zlibmodule.c's compress/decompress/checksum
# dispatch. io.ReadCloser.Close calls after ReadAll are cleanup-only.
# Error strings mirror CPython's zlib.error format strings verbatim.
- path: module/zlib/module\.go
linters:
- errcheck
- errorlint
- gocritic
- gocognit
- gocyclo
# BytesCtor mirrors CPython's bytes_new_impl dispatch on the
# source/encoding combinations; the branch tree is the parity
# unit with Objects/bytesobject.c.
- path: builtins/ctor\.go
linters:
- gocognit
- gocyclo
# strFormatExpand ports CPython's PyUnicode_Format conversion
# loop branch-for-branch.
- path: objects/str_bind\.go
linters:
- gocognit
- gocyclo
# UnicodeWriter.PrepareInternal mirrors _PyUnicodeWriter_PrepareInternal
# branch-for-branch; the alias / kind-upgrade / grow tree is the
# parity unit with Objects/unicodeobject.c.
- path: objects/unicode_writer\.go
linters:
- gocognit
- gocyclo
# specializeInstanceLoadAttr mirrors specialize_instance_load_attr's
# branch tree in Python/specialize.c case-for-case.
- path: specialize/load_attr\.go
linters:
- gocognit
- gocyclo
# typevarobject.c error messages end with periods and ellipsis-style
# punctuation. We keep them verbatim for compat-test parity, so
# ST1005 does not apply.
# The init() function wires every TypeVar / ParamSpec / TypeVarTuple /
# TypeAliasType descriptor in one block, matching typevarobject.c's
# tp_getset / tp_methods table layout. The complexity is the surface,
# not algorithmic branching.
# typealiasTpNew mirrors typealias_new_impl's positional+keyword
# argument dispatch branch-for-branch.
- path: objects/typevar\.go
linters:
- staticcheck
- gocognit
- gocyclo
# emitTypeParams mirrors codegen_type_params: one switch arm per
# TypeVar / TypeVarTuple / ParamSpec, with the LOAD_CONST /
# CALL_INTRINSIC branch tree per arm. That shape is the parity unit
# with Python/codegen.c.
- path: compile/codegen_typeparams\.go
linters:
- gocognit
- gocyclo
# GetExprName mirrors _PyPegen_get_expr_name's type-switch
# arm-for-arm. The cyclomatic complexity is the surface, not a
# function we can collapse without breaking parity.
- path: parser/pegen/actions\.go
linters:
- gocyclo
# patternOr / patternMapping / patternClass mirror Python/codegen.c's
# codegen_pattern_or / codegen_pattern_mapping / codegen_pattern_class
# branch-for-branch. The store-rotation, control list, and rest-dict
# build sequences are the parity unit with CPython.
- path: compile/codegen_stmt_match\.go
linters:
- gocognit
- gocyclo
# The _pickle decoder's load() dispatch loop mirrors
# Modules/_pickle.c:6950 load case-for-case. Each opcode arm is one
# case in the CPython switch; collapsing them would break parity.
- path: module/_pickle/decoder\.go
linters:
- gocognit
- gocyclo
# compileFunctionLike mirrors codegen_function's type-params /
# defaults / annotations / closure / decorator wiring branch-for-branch.
# The complexity is the parity unit with Python/codegen.c.
- path: compile/codegen_stmt_funclike\.go
linters:
- gocognit
- gocyclo
# unwindFblock mirrors codegen_unwind_fblock's per-kind dispatch
# table branch-for-branch. The cleanup sequences are the parity
# unit with Python/codegen.c.
- path: compile/codegen_stmt_control\.go
linters:
- gocognit
- gocyclo
# validate.go and validate_panel.go carry CPython's exact validator
# error messages (Python/ast.c _PyAST_Validate). Lowercasing them
# would break any caller that compares the text to CPython output.
# ST1005 does not apply to CPython-verbatim error strings.
- path: ast/validate.*\.go
linters:
- staticcheck
# ast_bridge.go and ast_bridge_reverse.go mirror CPython's
# PyAST_obj2mod / ast.c per-node-kind dispatch. The complexity and
# QF1011 suggestions do not apply to this verbatim port.
- path: builtins/ast_bridge.*\.go
linters:
- staticcheck
- gocognit
- gocyclo
# decodeUnicodeEscape mirrors CPython's unicode_escape_decode
# branch-for-branch. The complexity is the parity surface.
- path: codecs/unicode_escape\.go
linters:
- gocognit
- gocyclo
# emitFunctionAnnotateBody mirrors codegen_function's annotation
# wiring in Python/codegen.c; the branch tree is the parity unit.
- path: compile/codegen_annotations\.go
linters:
- gocognit
- gocyclo
# buildClass mirrors type_new_impl / type_call dispatch in
# Objects/typeobject.c; collapsing the arms would break parity.
- path: vm/build_class\.go
linters:
- gocognit
- gocyclo
# analyzeName mirrors _PyST_AnalyzeName from Python/symtable.c;
# the per-flag switch is the parity unit.
- path: symtable/analyze\.go
linters:
- gocognit
- gocyclo
# template_str.go wires every Template/Interpolation descriptor in
# one init() block matching templatestr's tp_getset table layout.
- path: objects/template_str\.go
linters:
- gocognit
- gocyclo
- revive
- unconvert
# str_bind.go ports PyUnicode_Format and str.format_map; the
# nested option/sep parsing resists switch collapse (gocritic).
# `close` is used as a local variable matching CPython's C
# variable name in the format_spec parser (revive redefines-builtin-id).
- path: objects/str_bind\.go
linters:
- gocritic
- revive
# set.go's init() wires every set/frozenset descriptor in one block,
# matching Objects/setobject.c's tp_methods / tp_getset table layout.
# The complexity is the surface, not algorithmic branching.
- path: objects/set\.go
linters:
- gocognit
- gocyclo
# binaryOp and trySimple mirror ceval.c's BINARY_OP dispatch and the
# hand-written opcode switch; branch tree is the parity unit with CPython.
- path: vm/eval_simple\.go
linters:
- gocyclo
- gocognit
# floatPower mirrors float_pow from Objects/floatobject.c: the
# special-case table for (0,0), inf, nan, negative base is the
# parity unit. floatFromNumber mirrors float_from_number_impl's
# type-dispatch branch tree.
- path: objects/float.*\.go
linters:
- gocognit
- gocyclo
# StrOf mirrors unicode_new's encoding/errors/object dispatch
# branch-for-branch; the complexity is the parity surface.
- path: builtins/reflect\.go
linters:
- gocognit
- gocyclo
# decodeUTF8 mirrors CPython's utf8_decode inner loop with per-byte
# state tracking; the branch tree is the parity unit.
- path: codecs/builtin\.go
linters:
- gocognit
- gocyclo
# dict_iter init() wires every dict iterator descriptor in one block,
# matching Objects/dictobject.c's tp_methods table layout.
- path: objects/dict_iter\.go
linters:
- gocognit
- gocyclo
# sliceGetLongIndices mirrors PySlice_GetIndicesEx and the extended
# long-index variant; naked returns are the parity-faithful shape.
- path: objects/slice_indices\.go
linters:
- gocognit
- gocyclo
- nakedret
# minMax ports min_max from Python/bltinmodule.c: the default/key
# kwarg handling plus the single-arg-iterable vs varargs split is
# the branch tree that matches the upstream builtin.
- path: builtins/aggregate\.go
linters:
- gocognit
- gocyclo
# copyNamespaceToType and installSlots mirror type_new_set_attrs and
# fixup_slot_dispatchers from Objects/typeobject.c: the per-dunder
# slot-wiring branches are the parity unit with CPython.
- path: objects/usertype\.go
linters:
- gocognit
- gocyclo
# tryImport mirrors import_name plus _PyEval_ImportFrom from
# Python/ceval.c: the fromlist / submodule / fallback branches are the
# parity unit with CPython's import machinery.
- path: vm/eval_import\.go
linters:
- gocognit
- gocyclo
formatters:
enable:
- gofmt
- gofumpt
- goimports
settings:
goimports:
local-prefixes:
- github.com/tamnd/gopy
exclusions:
paths:
# Generated parser table; the generator emits this verbatim
# and gofmt-aligning it would diverge from the rule numbering
# in the source grammar.
- parser/pegen/parser_gen.go
# Code generator output; formatting is owned by the generator.
- Tools/
issues:
max-same-issues: 0
max-issues-per-linter: 0