Skip to content

Commit f1ac0e2

Browse files
committed
fix all build errors and test failures for CLI and Xcode app (ivk-5u2, vfk-vlj, 4si-g2g)
- promote package → public on ~80 declarations for cross-target visibility - add Sendable conformance to RuleViolation, LinterCache, FormatRuleCatalog - exclude .format/.suggest scope rules from default lint configuration - fix PeriodSpacingRule regex for Swift Regex engine compatibility - add SwiftSyntax-based comment exclusion fallback when SourceKit is disabled - fix two-pass collect-then-validate in test helpers for CollectingRule - restore BridgeExtensions.swift, fix Command \r\n handling
1 parent 9b18aee commit f1ac0e2

91 files changed

Lines changed: 879 additions & 349 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/settings.local.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@
6565
"mcp__xc-project__remove_target",
6666
"mcp__xc-build__clean",
6767
"mcp__xc-build__list_schemes",
68-
"mcp__xc-swift__swift_diagnostics"
68+
"mcp__xc-swift__swift_diagnostics",
69+
"mcp__xc-build__set_session_defaults",
70+
"mcp__xc-build__test_macos",
71+
"mcp__xc-build__list_test_plan_targets",
72+
"WebFetch(domain:www.swift.org)",
73+
"WebFetch(domain:wwdcnotes.com)"
6974
]
7075
},
7176
"enableAllProjectMcpServers": true,

.claude/skills/docc/SKILL.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,133 @@ This project follows specific DocC patterns. See [references/swiftiomatic-conven
109109
- How to document rules and analysis categories
110110
- Cross-referencing between rule types and configuration
111111

112+
## Metadata Directives
113+
114+
Use `@Metadata` at the top of an article (after the title) to control page behavior and appearance:
115+
116+
```markdown
117+
# My Sample Project
118+
119+
@Metadata {
120+
@PageKind(sampleCode)
121+
@CallToAction(url: "https://github.com/org/repo", purpose: link)
122+
@PageImage(purpose: card, source: "project-card", alt: "Screenshot of the project")
123+
@PageColor(green)
124+
}
125+
126+
Summary sentence.
127+
```
128+
129+
### @PageKind
130+
131+
Sets the page type and navigator icon. Values: `article` (default for `.md` files), `sampleCode`.
132+
133+
Sample code pages display "Sample Code" as the role heading (eyebrow text above the title) and get a distinct sidebar icon.
134+
135+
### @CallToAction
136+
137+
Adds a prominent button in the page header. Use with sample code pages to link to the source repo or download.
138+
139+
| Parameter | Description |
140+
|-----------|-------------|
141+
| `url` | External URL (use for repo links) |
142+
| `file` | Local file path relative to the `.docc` bundle (use for downloads) |
143+
| `purpose` | Default label: `link` → "Visit", `download` → "Download" |
144+
| `label` | Custom button text (overrides `purpose` label) |
145+
146+
One of `url` or `file` required. One of `purpose` or `label` required. Only one `@CallToAction` per page.
147+
148+
```markdown
149+
@Metadata {
150+
@CallToAction(url: "https://github.com/org/repo", label: "View on GitHub")
151+
}
152+
```
153+
154+
### @PageImage
155+
156+
Sets the card image shown when the page appears in a `@Links` grid. Also used as the page's icon.
157+
158+
```markdown
159+
@PageImage(purpose: card, source: "my-image", alt: "Description")
160+
```
161+
162+
The `source` references an image file in the `Resources/` directory (without extension). Supports `@2x` and `~dark` variants.
163+
164+
### @PageColor
165+
166+
Sets the accent color for the page. Built-in colors: `blue` (default), `green`, `yellow`, `orange`, `purple`, `red`.
167+
168+
```markdown
169+
@PageColor(green)
170+
```
171+
172+
## @Links Directive
173+
174+
Feature documentation pages with styled link collections anywhere on a page — outside the `## Topics` section.
175+
176+
```markdown
177+
@Links(visualStyle: detailedGrid) {
178+
- <doc:SampleProject1>
179+
- <doc:SampleProject2>
180+
- <doc:GettingStartedGuide>
181+
}
182+
```
183+
184+
### visualStyle Options
185+
186+
| Style | Shows | Best for |
187+
|-------|-------|----------|
188+
| `list` | Title + abstract (matches Topics style) | General link lists |
189+
| `compactGrid` | Card image + title only | Visual galleries, sample code collections |
190+
| `detailedGrid` | Card image + title + abstract | Featured content with descriptions |
191+
192+
Card images come from `@PageImage(purpose: card, ...)` on the linked page. Pages without a card image still work but show a placeholder.
193+
194+
The directive can only contain `<doc:>` links — no headings or prose inside the block.
195+
196+
## Sample Code Page Template
197+
198+
A complete sample code page combining these directives:
199+
200+
```markdown
201+
# Building a Custom Linter
202+
203+
@Metadata {
204+
@PageKind(sampleCode)
205+
@CallToAction(url: "https://github.com/org/custom-linter", purpose: link)
206+
@PageImage(purpose: card, source: "custom-linter-card", alt: "Custom linter running in Xcode")
207+
@PageColor(purple)
208+
}
209+
210+
Learn how to build a custom Swift linter using Swiftiomatic's rule API.
211+
212+
## Overview
213+
214+
This sample project demonstrates creating rules, configuring severity,
215+
and integrating with Xcode's build system.
216+
217+
## Topics
218+
219+
### Essentials
220+
- <doc:CreatingYourFirstRule>
221+
- ``Rule``
222+
- ``RuleConfiguration``
223+
```
224+
225+
### Featuring Sample Code from a Landing Page
226+
227+
On Main.md or a category page, use `@Links` to showcase sample projects:
228+
229+
```markdown
230+
## Featured Sample Code
231+
232+
@Links(visualStyle: compactGrid) {
233+
- <doc:BuildingACustomLinter>
234+
- <doc:IntegratingWithXcode>
235+
- <doc:WritingFormatRules>
236+
}
237+
```
238+
112239
## Layout Directives
113240

114241
For rich layouts beyond standard Markdown:
@@ -135,6 +262,20 @@ For rich layouts beyond standard Markdown:
135262
}
136263
```
137264

265+
## What NOT to Use DocC For
266+
267+
**Rule documentation** (examples, triggering/non-triggering code, corrections) must stay in the Swift type system — not DocC. The `RuleDescription` and `FormatRule` types carry structured data that DocC cannot express:
268+
269+
- `nonTriggeringExamples` / `triggeringExamples` arrays of `Example` with per-example configuration overrides and test metadata (`shouldTestMultiByteOffsets`, `shouldTestWrappingInComment`, etc.)
270+
- `corrections` dictionary mapping before→after code for auto-fix validation
271+
- FormatRule `examples` closures with string interpolation of runtime values (e.g. `VisibilityCategory.defaultOrdering(...)`)
272+
- `options` / `sharedOptions` arrays consumed by `generate-docs` and CLI `--help`
273+
274+
This data is consumed programmatically at runtime (CLI help, `generate-docs` markdown output, test harnesses). DocC is a compile-time documentation system that produces HTML — it cannot serve these use cases.
275+
276+
**Use DocC for:** module-level overviews, conceptual articles, API symbol documentation, guides.
277+
**Use RuleDescription/FormatRule for:** per-rule examples, configuration docs, triggering/non-triggering code.
278+
138279
## Common Issues
139280

140281
| Problem | Solution |
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
# 3eb-r8b
3+
title: Remove .bridge() calls — use idiomatic Swift casts
4+
status: completed
5+
type: task
6+
priority: normal
7+
created_at: 2026-03-01T18:45:33Z
8+
updated_at: 2026-03-01T18:48:35Z
9+
sync:
10+
github:
11+
issue_number: "129"
12+
synced_at: "2026-03-01T21:06:29Z"
13+
---
14+
15+
Replace all .bridge() call sites with idiomatic Swift: drop where String extensions exist, use `as NSString` for path ops, explicit casts for NSRange loops, .utf8.count for byte lengths.
16+
17+
18+
## Summary of Changes
19+
20+
Replaced all 17 compiled `.bridge()` call sites across 11 files with idiomatic Swift:
21+
22+
- **Drop `.bridge()`** where String extensions already exist: `absolutePathStandardized()`, `fullNSRange` (3 sites)
23+
- **`as NSString` casts** for path operations: `lastPathComponent`, `deletingPathExtension`, `appendingPathComponent` (7 sites)
24+
- **Explicit `as NSString`/`as String` casts** in NSRange replacement loops: ExplicitSelfRule, UnusedImportRule (5 sites)
25+
- **`.utf8.count`** replacing `.bridge().lengthOfBytes(using: .utf8)` (1 site)
26+
- **`(x as NSString).replacingCharacters(in:with:)`** in SyntacticSugarRule (1 site)
27+
- **Skipped** 2 occurrences in UnavailableFunctionRule — inside `Example("""...""")` string literals, not compiled code
28+
29+
All changes are zero-cost toll-free bridging. No functional behavior change.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# 4si-g2g
3+
title: Fix build warnings after ViolationSeverity→Severity rename
4+
status: in-progress
5+
type: bug
6+
priority: normal
7+
created_at: 2026-03-01T19:53:36Z
8+
updated_at: 2026-03-01T19:53:36Z
9+
sync:
10+
github:
11+
issue_number: "127"
12+
synced_at: "2026-03-01T21:06:26Z"
13+
---
14+
15+
Build warnings/errors after ViolationSeverity→Severity rename and BridgeExtensions.swift deletion.
16+
17+
## Tasks
18+
- [ ] Build to capture all warnings/errors
19+
- [ ] Fix each warning
20+
- [ ] Rebuild to verify clean build
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
# 7y2-kma
3+
title: Evaluate consistent use of RuleDescription across SwiftLint and SwiftFormat-derived rules
4+
status: in-progress
5+
type: task
6+
priority: normal
7+
created_at: 2026-03-01T20:20:03Z
8+
updated_at: 2026-03-01T20:26:02Z
9+
sync:
10+
github:
11+
issue_number: "128"
12+
synced_at: "2026-03-01T21:06:26Z"
13+
---
14+
15+
Audit the two rule systems (Rule protocol with RuleDescription vs FormatRule class) for consistency in how rule metadata is described, documented, and consumed. Identify gaps and recommend whether/how to unify.
16+
17+
- [x] Map the two metadata models
18+
- [x] Identify field coverage gaps
19+
- [x] Evaluate generate-docs coverage
20+
- [x] Assess RuleCatalog bridge completeness
21+
- [x] Write findings and recommendations
22+
23+
## Summary of Changes
24+
25+
Evaluation only — no code changes. Findings:
26+
27+
1. **Two separate metadata systems**: Rule uses RuleDescription struct (11 fields); FormatRule uses inline stored properties (help, examples, options). They don't share a type.
28+
2. **RuleCatalog bridges them** at the query layer via Entry, but loses rich metadata.
29+
3. **generate-docs excludes FormatRules** entirely — 130 rules get no documentation output.
30+
4. **Naming mismatch**: Rules use snake_case identifiers, FormatRules use camelCase names.
31+
5. **rationale field adopted by only 14/323 rules** — dead API surface.
32+
6. **Recommendation**: Don't unify the types (different execution models). Instead: (a) extend generate-docs for FormatRules, (b) add a RuleMetadata protocol for the common interface, (c) normalize naming, (d) audit rationale adoption.
Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
11
---
22
# ay9-7gx
33
title: Unify ViolationSeverity and DiagnosticSeverity into one enum
4-
status: ready
4+
status: completed
55
type: task
66
priority: normal
77
created_at: 2026-03-01T07:58:51Z
8-
updated_at: 2026-03-01T07:58:51Z
8+
updated_at: 2026-03-01T18:37:30Z
99
sync:
1010
github:
1111
issue_number: "122"
12-
synced_at: "2026-03-01T08:00:21Z"
12+
synced_at: "2026-03-01T21:06:26Z"
1313
---
1414

1515
These two severity enums serve overlapping purposes but are deeply entangled throughout the codebase. Unifying them requires careful migration of all call sites.
1616

1717
Deferred from vu5-l8x because of the scope of changes required.
18+
19+
20+
21+
## Summary of Changes
22+
23+
Unified `ViolationSeverity` (package, internal) and `DiagnosticSeverity` (public, output) into a single `public enum Severity` with all necessary conformances.
24+
25+
- **Renamed** `ViolationSeverity.swift``Severity.swift` via `git mv` (preserves history)
26+
- **Promoted** access level from `package` to `public`; added `public` to `<` operator (fixes missing `Comparable` impl bug on old `DiagnosticSeverity`)
27+
- **Deleted** `DiagnosticSeverity` enum from `Diagnostic.swift`
28+
- **Simplified** `RuleViolation.toDiagnostic()` — severity passes through directly instead of manual conversion
29+
- **Renamed** `typealias Severity` in `NestingRule+Configuration` and `NameConfiguration` to avoid shadowing the new module-level `Severity` enum
30+
- **Mechanical rename** across 20+ files in Sources/ and Tests/

0 commit comments

Comments
 (0)