-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.swiftlint.yml
More file actions
146 lines (133 loc) · 6.85 KB
/
Copy path.swiftlint.yml
File metadata and controls
146 lines (133 loc) · 6.85 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
# SwiftLint configuration for MutantKit.
#
# Tuned against the codebase as it already reads, not against a stock
# ruleset: thresholds below were derived by running a config-less
# `swiftlint lint` over Sources/ and Tests/ and looking at what actually
# fired, then deciding per rule whether the violation was a real defect
# (fixed), a deliberate house pattern (rule adjusted or disabled), or
# unavoidable-without-a-refactor complexity debt (threshold raised enough
# to stop erroring, left as a warning, documented here).
#
# CI runs `swiftlint lint --strict --baseline .swiftlint-baseline.json`:
# the baseline freezes 134 pre-existing violations by identity (rule + file +
# line) so `--strict` still catches every new violation, including a new one
# in an already-baselined file, without forcing a refactor of any of them
# just to silence the linter. By rule: `line_length` 78 (mostly long test
# lines and interpolated diagnostics), `type_body_length` 16, `large_tuple`
# 13, `function_body_length` 9, `function_parameter_count` 6,
# `file_length` 5, `cyclomatic_complexity` 3, `force_try` 2, plus one
# `unused_enumerated` and one `orphaned_doc_comment`. The length/complexity
# rules concentrate in a few deliberately large orchestration files
# (MutationRunner.swift, SchemataMutationRunner.swift, XcodeBuildAdapter.swift
# and similar), but `cyclomatic_complexity` also covers ConfigurationValidation
# (13), DeclarationIdentityResolver (15) and one simulator-pool test — and
# `large_tuple` is spread across several test files. This count includes a
# handful of entries private-tree-only targets (research/probe executables,
# benchmark harness) contribute that the public projection's own baseline
# doesn't carry, since those targets are excluded from the public snapshot.
# (Earlier versions of this comment also named InspectCommand.run()/
# RunCommand.run(), then QualityGate.evaluate (16)/
# BudgetSelectorV2.allocateCounts (18), then a ReproduceCommand handler (13);
# all five have since been split far enough that none is baselined anymore.)
#
# Baseline entries key on line number, so an unrelated edit earlier in a
# baselined file shifts every violation below it and makes CI fail on an
# "unrecognized" (but not actually new) violation — regenerate with
# `swiftlint lint --write-baseline .swiftlint-baseline.json` when that
# happens, and diff the regenerated file against the old one to confirm only
# line numbers moved, not that a genuinely new violation got swept in
# unnoticed. The baseline format is also SwiftLint-version-specific; CI pins
# an exact version (see ci.yml) so a SwiftLint upgrade can't silently change
# which violations the baseline recognizes.
excluded:
- .build
- Fixtures # sample Xcode/SPM projects used as acceptance-test fixtures, not project code
- Research # research notes / one-off operator-catalog samples, not shipped code
- reference # gitignored third-party clones kept locally for investigation, not shipped code
# Long lines are ignored in three shapes that are common and deliberate here:
# doc/rationale comments, `\(...)`-interpolated diagnostic strings, and
# multi-line `"""` JSON fixtures. Actual code is still capped, just at 140
# instead of the 120 default, since a handful of genuine code lines
# (mostly argument lists) sit in the 121-140 range across an 18.5k-line
# codebase where 99%+ of lines are already under 100.
line_length:
warning: 140
error: 220
ignores_urls: true
ignores_comments: true
ignores_interpolated_strings: true
ignores_multiline_strings: true
# MutationRunner.swift (2817 lines after ADR-0006 Stage 1 routed every
# result-producing path through one shared MutationObservations ->
# MutationVerdictVerifier -> ResultLedger finalization choke point) and
# XcodeBuildAdapter.swift (1314 lines) are deliberate single-responsibility
# orchestrators (run loop / xcodebuild adapter); splitting them is a real
# refactor, not a lint fix, so the ceiling is raised to keep today's
# codebase clean while still catching a file that grows well past that.
file_length:
warning: 1000
error: 2900
# MutationRunner's main type crosses the stock 350-line error threshold by
# well over 3x; same reasoning as file_length above.
type_body_length:
warning: 300
error: 1600
# A few orchestration methods (MutationRunner's batch/incremental paths,
# PrioritizingTestAdapter) run 60-90 lines because they're a single linear
# sequence of "do this, then this" steps, not deeply nested logic. Raised
# past today's max (91) rather than disabled, so a function that balloons
# further still gets flagged.
function_body_length:
warning: 80
error: 220
# CLI command `run`/`validate` bodies and a few config-validation functions
# sit at 11-16 branches from enumerating independent flag/config checks.
# Left as warnings (not disabled) so genuinely tangled logic still gets
# caught; ceiling raised past today's max (23, InspectCommand) so it isn't
# an error today.
cyclomatic_complexity:
warning: 12
error: 25
# A couple of adapters nest a small result/error type one level deeper
# than the default allows; harmless scoping, not a smell.
nesting:
type_level:
warning: 2
# Test helpers occasionally return a 3-4 member tuple (report/build/test/log)
# instead of a named struct. Left as a warning either way.
large_tuple:
warning: 2
error: 5
# ProcessSupervisor/MutationRunner/MutationID all have one call site with a
# 6th parameter; not worth a parameter-object refactor for one extra arg.
function_parameter_count:
warning: 6
error: 8
# Deliberate short names are the norm here: `fm` (FileManager), `fd` (file
# descriptor), `l` (line), `a`/`b` (tuple destructuring), `z`, `ok` (enum
# case). These are standard, well-understood abbreviations in systems code
# and renaming them adds nothing; the length floor is effectively removed
# rather than special-cased name by name.
identifier_name:
min_length:
warning: 1
# XCTest/Swift Testing suite names are long and descriptive on purpose
# (e.g. `XcodeIncrementalBatchTestingAcceptanceTests`, 44 chars) so they
# read as a sentence describing what's under test.
type_name:
max_length:
warning: 60
disabled_rules:
# The codebase deliberately uses `String(decoding:as:)` (never-fails,
# replaces invalid bytes) instead of the failable `String(bytes:encoding:)`
# this rule wants, specifically for output it knows is always valid UTF-8
# (its own JSON encoder's output). That's a considered choice, not an
# oversight — forcing the failable initializer here would just add an
# unwrap for a case that can't happen.
- optional_data_string_conversion
# Compiler-aware rules: these run ONLY under `swiftlint analyze` with a
# clean xcodebuild log, never under `swiftlint lint`. Scope is deliberately
# one rule: `unused_import` catches exactly the failure class a pure file
# move introduces (a leftover import no syntax-only rule sees).
analyzer_rules:
- unused_import