.qlty/qlty.toml

87 lines · 2938 bytes

 1config_version = "0"
 2
 3exclude_patterns = [
 4  "**/vendor/**",
 5  "**/node_modules/**",
 6  "**/testdata/**",
 7  "**/dist/**",
 8  "**/.build/**",
 9  "**/build/**",
10  "**/*.min.*",
11  "**/generated/**",
12  ".claude/**",
13  "**/Pods/**",
14  # DEBUG-only seed data for the accessibility audit tests.
15  "DomainDig/AuditFixtures.swift",
16]
17
18test_patterns = [
19  "**/test/**",
20  "**/tests/**",
21  "**/Tests/**",
22  "**/*_test.*",
23  "**/test_*.*",
24  "**/*.test.*",
25  "**/*Tests.swift",
26  "e2e/**",
27]
28
29[[source]]
30name = "default"
31default = true
32
33[[plugin]]
34name = "osv-scanner"
35
36[[plugin]]
37name = "trufflehog"
38
39# Early returns are guard clauses, which keep the happy path unindented.
40[smells.return_statements]
41enabled = false
42
43# File complexity is a ratchet rather than a target: the threshold sits just
44# above today's worst file and fails anything past it. Lower it when a file is
45# genuinely split, never raise it to make a commit pass.
46#
47# Measured after A4 and the portfolio split: DomainViewModel 272,
48# CloudSyncService 198, WatchlistView 146, DomainDataPortabilityService 146,
49# AuditViews 128, ContentView 119, DomainDiffViews 115,
50# DomainReportExporter 114, SettingsViews 112, WorkflowsView 107.
51#
52# DomainViewModel still holds this threshold, and moving code has stopped
53# paying: the last 145 lines out of it bought 8 points, because what is left
54# is orchestration rather than separable clusters. Going much below 270 needs
55# the batch pipeline restructured, not relocated — it writes six
56# `private(set)` properties and calls back into eight view-model members, so
57# any extraction either widens that state or carries a back-reference. See
58# A13 for the measurements.
59[smells.file_complexity]
60enabled = true
61
62# Function complexity stays off because qlty's Swift parser mis-attributes it
63# here, not because the metric is unwanted. It reports `existingShare`
64# (CloudSyncService:336, eight lines, seven statements) as complexity 184
65# spanning lines 336-1515 — the whole rest of the file. `fetchZoneChanges` in
66# the same file is measured correctly (31, lines 1049-1135), so the fault is
67# inconsistent rather than systematic.
68#
69# That leaves no usable threshold. Anything at or under 184 fails on the
70# artifact and nothing else; anything above it cannot fail on the one real
71# result. A gate whose only output is a false positive teaches you to ignore
72# it. Revisit when qlty's Swift grammar changes.
73[smells.function_complexity]
74enabled = false
75
76# Exhaustive switch-over-enum lookup tables share shape but not content.
77[language.swift.smells.duplication]
78# ownershipHistory and dnsHistory each pair a local history with an external one and merge
79# them; one generic version would take six closures.
80filter_patterns = [
81  "(import_declaration _)",
82  "(switch_statement _)",
83  "(function_declaration name: (simple_identifier) @_n (#match? @_n \"^(ownershipHistory|dnsHistory)$\"))",
84]
85
86[language.swift.smells.file_complexity]
87threshold = 280