chore(#36): trial the ecosystem code-style policy - #37
Merged
Conversation
Pilot repo for the ecosystem's code-style policy proposal, following the reference
rollout at OCCTSwiftScripts#114/#115. This repo is small (24 Swift files, ~2,459
lines), so a full sweep rather than a gradual exemption manifest: sweep the whole
tree into compliance in one PR and turn on zero-tolerance blocking CI immediately.
- .swift-format: 100 col, 4-space (the ecosystem's one deliberate divergence from
Google's 2-space default), copied verbatim from OCCTSwiftScripts.
- .swiftlint.yml: scoped to orphaned_doc_comment only via only_rules, not the
default set, same rationale as the reference repo.
- Scripts/comment-ratio-check.sh: report-only nudge, never fails. Bootstraps this
repo's first Scripts/ dir.
- .github/workflows/code-style.yml: swift-format lint --strict and swiftlint lint
--strict as blocking gates, comment-ratio as a non-blocking step. Bootstraps
this repo's first CI workflow (none existed before).
- okf/policies/code-style.md, linked from okf/index.md, matching this repo's
existing frontmatter conventions.
- Full Sources/+Tests/ sweep via swift-format --in-place, plus by-hand fixes for
the lint-only findings swift-format --in-place can't auto-fix:
- BeginDocumentationCommentWithOneLineSummary: 26 doc comments split into a
one-sentence summary + blank line + detail, across Mesh.swift, GLTFAdapter.swift,
MeshIO.swift, OBJ.swift, STL.swift, PLY.swift, ThreeMFAdapter.swift,
CADBodyMetadata.swift, DXFLoader.swift (x3), ShapeLoader.swift (x6), and four
Tests files.
- EndOfLineComment: 3 over-length trailing comments moved to their own line
(GLTFAdapter.swift, MeshIO.swift, DXFLoader.swift), plus 1 in a test file.
- AlwaysUseLowerCamelCase: local `export_` renamed to `exported` in
MLExport.swift and all 4 call sites in MLExportTests.swift (local-only).
- Two "terminate this sentence with a period" fixes (DXFLoaderTests.swift,
JWWLoaderTests.swift): trailing parenthetical restructured so the doc
comment ends on a period, not a closing paren.
Also clears every em-dash from every file this sweep touches, per this repo's
own writing-style policy ("clear them from any file you are already editing").
Left one string literal alone (Sources/MeshIO/OBJ.swift's exported-file header
comment) since it's runtime output content, not source-level prose, and
changing it would be a behavior change outside this PR's scope.
Verified locally, before and after the sweep:
- swift-format lint --strict, swiftlint lint --strict, comment-ratio-check.sh
all pass (zero violations from both linters).
- swift build succeeds identically before and after.
- OCCT_SERIAL=1 swift test --parallel --num-workers 1: 41/41 tests pass, both
before and after the sweep, same suite, same count.
Filed per the ecosystem's own gate: no repo implements without a filed issue
first. Closes #36.
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
Pilot repo for the ecosystem's proposed code-style policy
(
ecosystemdocs/code-style-policy-proposal-2026-08.md),following the reference rollout at
OCCTSwiftScripts#114 /
#115. This repo is small (24 Swift
files, ~2,459 lines), so a full sweep rather than a gradual exemption manifest: bring the whole
tree into compliance in one PR and go 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-placesweep of
Sources/+Tests/..swiftlint.yml, scoped toonly_rules: [orphaned_doc_comment], same rationale as the referencerepo: SwiftLint's defaults duplicate
swift-format's formatting opinions and open a separatecode-quality/complexity surface that belongs to the ecosystem's own
code-structurepolicy, notthis one.
Scripts/comment-ratio-check.sh: report-only nudge (never fails). This bootstraps the repo'sfirst
Scripts/directory..github/workflows/code-style.yml:swift-format lint --strictandswiftlint lint --strictas blocking gates, comment-ratio as a non-blocking step. This bootstraps the repo's first CI
workflow; there was no GitHub Actions setup here before this PR.
okf/policies/code-style.md, linked fromokf/index.md, matching this repo's existingfrontmatter conventions.
swift-format --in-placecan't auto-fix:BeginDocumentationCommentWithOneLineSummary(28 doc comments): split into a one-sentencesummary, a blank
///line, then the detail, acrossMesh.swift(x4),GLTFAdapter.swift,MeshIO.swift(x2),OBJ.swift,STL.swift,PLY.swift,ThreeMFAdapter.swift(x3),CADBodyMetadata.swift,DXFLoader.swift(x3),ShapeLoader.swift(x7), and fourTestsfiles.
EndOfLineComment(4): trailing comments that pushed the line past the column limit,moved to their own line above (
GLTFAdapter.swift,MeshIO.swift,DXFLoader.swift,DXFLoaderTests.swift).AlwaysUseLowerCamelCase(4 declarations, local-only):export_renamed toexportedeverywhere it appeared, one declaration in
MLExport.swiftand three separate localdeclarations across
MLExportTests.swift's test functions, each updated in place.DXFLoaderTests.swift,JWWLoaderTests.swift): a trailing parenthetical restructured so the doc comment's lastcharacter is a period, not a closing paren.
Also clears every em-dash from every file this sweep touches, per this repo's own
writing-style policy ("clear them from any file you are already
editing"). One deliberate exception:
Sources/MeshIO/OBJ.swift's exported-file header comment(
"# MeshIO OBJ ...") is left as-is, since it's a string literal written into the output file(runtime content, not source-level prose), and changing it would be a behavior change outside this
PR's scope.
Explicitly out of scope here (matching the pilot repo's precedent):
clang-format, this repocarries zero first-party C++ bridge files, confirmed before starting.
Zero behavior change. All changes are formatting, doc-comment structure, or a local-only
rename; verified directly, not just asserted:
swift-format lint --strictandswiftlint lint --strict: zero violations, both before commit.Scripts/comment-ratio-check.sh: runs clean (2 files flagged above the 1.0x nudge threshold,CADBodyMetadata.swiftandImportProgressClosure.swift; report-only, does not fail).swift build: succeeds identically before and after the sweep.OCCT_SERIAL=1 swift test --parallel --num-workers 1: 41/41 tests pass, same suite, samecount, both before and after the sweep.
Package.resolveddrift from any local build/test run.Closes #36
Checklist
verification); see SecondMouseAU/OCCTReconstruct#397
for the ecosystem-wide test-coverage standard this is piloting.
N/A here: no behavior changed (formatting/doc-comments/CI only, one local-only rename),
verified via the existing test suite (41/41 pass, identical before/after) rather than new
tests, since there's 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
#36 before any of this landed. Holding for review before merge, per the same process
OCCTSwiftScripts#115 followed.
Separately: this repo's
okf/index.mdcurrently links 4 of the ecosystem's 6 current mandatorypolicies (missing
issue-trackingandcode-structure). Not addressed in this PR, out of scopefor a code-style rollout; flagging in case it is worth its own issue.
🤖 Generated with Claude Code