chore(#13): roll out ecosystem code-style policy (full sweep) - #14
Merged
Conversation
Adds:
- .swift-format (100 col, 4-space, copied verbatim from OCCTSwiftScripts,
the ecosystem's reference implementation for this policy) + a full
swift-format --in-place sweep of Sources/ and Tests/.
- .swiftlint.yml, scoped to only_rules: [orphaned_doc_comment]. SwiftLint's
default rule set duplicates swift-format's formatting opinions and adds a
code-quality/complexity surface that overlaps the ecosystem's own
code-structure policy rather than this one.
- Scripts/comment-ratio-check.sh: report-only nudge (never fails), bash to
match this repo's own tooling convention.
- .github/workflows/code-style.yml: swift-format lint --strict and
swiftlint lint --strict as blocking gates, comment-ratio as a
non-blocking step. Bootstraps CI from nothing (no prior workflow existed).
- okf/policies/code-style.md, linked from okf/index.md, this repo's 7th
mandatory policy.
- Hand fixes for every swift-format lint --strict finding the automatic
sweep could not fix: BeginDocumentationCommentWithOneLineSummary (7 doc
comments split into a single-sentence summary + blank line + detail,
matching Google's Swift Style Guide's own doc-comment structure),
ReplaceForEachWithForLoop (2 sites in DXF.Drawing.bounds), EndOfLineComment
(1 site moved to its own line). SwiftLint's orphaned_doc_comment already
reported zero violations before any hand fixes were needed.
- Em-dashes removed from every file touched by the sweep, per this repo's
own writing-style policy ("clear them from any file you are already
editing").
Zero behavior change: formatting/doc-comment structure/CI only, no logic
touched. Verified directly:
- swift build and swift test run before and after the sweep: identical
results both times (build succeeds, 13/13 tests pass across 2 suites,
including the DXF_CORPUS oracle-comparison suite).
- swift-format lint --strict and swiftlint lint --strict: zero violations.
- Scripts/comment-ratio-check.sh: no files flagged.
Closes #13
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Roll out the ecosystem's code-style policy to this repo
(
ecosystemdocs/code-style-policy-proposal-2026-08.md),following the reference implementation
(OCCTSwiftScripts#114 /
OCCTSwiftScripts#115). This repo is
tiny (~547 Swift lines across 4 files:
Sources/SwiftMeshHeal/MeshHeal.swift,Sources/SwiftMeshHeal/HoleFill.swift,Tests/SwiftMeshHealTests/MeshHealTests.swift), so this isa full sweep, not a gradual exemption-manifest rollout, straight to a blocking gate.
Adds:
.swift-format(100 col, 4-space, the ecosystem's one deliberate divergence from Google's2-space default) copied verbatim from OCCTSwiftScripts, plus a full
swift-format --in-place --recursivesweep ofSources/+Tests/..swiftlint.yml, deliberately narrow (only_rules: [orphaned_doc_comment]). SwiftLint's defaultrule set duplicates
swift-format's formatting opinions (can disagree with them on the sameline) and separately opens a large code-quality/complexity surface (
identifier_name,cyclomatic_complexity,function_body_length,nesting, ...) that overlaps the ecosystem's owncode-structurepolicy rather than this one. Scoped down to the one rule that catches somethingswift-formathas no equivalent for.Scripts/comment-ratio-check.sh: report-only nudge (never fails), bash to match this repo's ownscript convention (not the Python style
OCCTSwift/Scripts/uses)..github/workflows/code-style.yml:swift-format lint --strictandswiftlint lint --strictasblocking gates, comment-ratio as a non-blocking step. Pure text analysis, no
swift buildneededin the gate itself.
okf/policies/code-style.md: linked fromokf/index.md.swift-format --in-placecould not auto-fix:BeginDocumentationCommentWithOneLineSummary(15 doc comments acrossMeshHeal.swiftandHoleFill.swift): inserted a blank///line after the one-line summary sentence, moving therest of the existing prose into a second paragraph. No content removed.
AlwaysUseLowerCamelCase(3 local renames, all insideHoleFill.swift'sliepaFill, allcall sites updated in the same function):
P->points,INF->inf,Wt->weightTable.Local-only, no public API surface touched.
EndOfLineComment(1 finding,Tests/SwiftMeshHealTests/MeshHealTests.swift): moved atrailing comment that exceeded the line length onto its own line above the statement.
(colon, comma, or a second sentence), per the ecosystem's writing-style policy, since these are
files this PR edits directly.
Explicitly out of scope (see #12):
clang-format(zero first-party C++ bridge files in this repo, confirmed), and any new docs-drifttooling beyond what this repo's existing
docs-current/context-firstpolicies already cover.Zero behavior change. Renames are local-only; everything else is formatting/doc-comment
restructuring plus the
publicaccess modifier moving from theextensiondeclaration to eachmember (swift-format's
NoAccessLevelOnExtensionDeclarationrule), which does not change thepublic API surface. Verified directly, not just asserted:
swift buildandswift test: identical result before and after this sweep (build succeeds,7/7 tests pass).
swift-format lint --strictandswiftlint lint --strict: both report zero violations.Scripts/comment-ratio-check.sh: no files at or above the 1.0x threshold.Package.resolvedwas created or touched (this package has no external dependencies).Checklist
verification); see SecondMouseAU/OCCTReconstruct#397
for the ecosystem-wide test-coverage standard this is piloting.
N/A here: no behavior changed (formatting/docs/CI only), verified via the existing
MeshHealTestssuite (7/7 passing, identical before and after) rather than new tests, sincethere is no new behavior for a new test to cover.
Notes for the reviewer
Per the ecosystem's own gate (no repo implements without a filed issue first), this was filed as
#12 before any of this landed. Holding
for review before merge.
Closes #12
🤖 Generated with Claude Code