chore(#9): roll out ecosystem code-style policy - #10
Merged
Conversation
Adds: - .swift-format (100 col, 4-space) copied verbatim from OCCTSwiftScripts, plus a full swift-format --in-place sweep of Sources/ and Tests/. - .swiftlint.yml, scoped to only_rules: [orphaned_doc_comment]. - Scripts/comment-ratio-check.sh: report-only nudge (never fails). - .github/workflows/code-style.yml: swift-format lint --strict and swiftlint lint --strict as blocking gates, comment-ratio as a non-blocking step. This repo had no .github/workflows/ before this change. - okf/policies/code-style.md, linked from okf/index.md: this repo's 7th mandatory OKF policy. - Hand-fixed every swift-format lint --strict finding the auto-formatter could not resolve on its own: BeginDocumentationCommentWithOneLineSummary (blank doc-comment line after the one-sentence summary, across 8 doc comments in JWW.swift/DXFWriter.swift/Reader.swift) and EndOfLineComment (moved 2 over-length trailing comments to their own line). - Cleared pre-existing em-dashes from every file touched, per the writing-style policy's own file. Zero behavior change: all edits are formatting/doc-comment structure only. Closes #9 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
The second pilot repo for the ecosystem's proposed code-style policy
(
ecosystemdocs/code-style-policy-proposal-2026-08.md),following the reference implementation already trialled in
OCCTSwiftScripts#114/#115. This repo is tiny(~699 Swift lines across ~6 files), so it gets the same treatment: a full sweep into
compliance in one PR with an immediate zero-tolerance blocking gate, not a gradual
exemption-manifest rollout.
Adds:
.swift-format(100 col, 4-space, the ecosystem's one deliberate divergence fromGoogle's own 2-space default), copied verbatim from
OCCTSwiftScripts, plus a fullswift-format --in-placesweep ofSources/+Tests/..swiftlint.yml, deliberately narrow (only_rules: [orphaned_doc_comment]). SwiftLint'sdefault rule set duplicates swift-format's formatting opinions (can disagree with them on
the same line) and separately opens a large code-quality/complexity surface
(
identifier_name,cyclomatic_complexity,function_body_length,nesting, ...) thatoverlaps the ecosystem's own
code-structurepolicy rather than this one. Scoped down tothe one rule that catches something swift-format has no equivalent for.
Scripts/comment-ratio-check.sh: report-only nudge (never fails), matching this repo'sown bash-script convention.
.github/workflows/code-style.yml:swift-format lint --strictandswiftlint lint --strictas blocking gates, comment-ratio as a non-blocking step. Puretext analysis, no
swift buildneeded. This repo had no.github/workflows/before thischange, so this bootstraps CI from nothing.
okf/policies/code-style.md: this repo's 7th mandatory policy, linked fromokf/index.md.swift-format --in-placecan't auto-fix:8x
BeginDocumentationCommentWithOneLineSummary(blank///line inserted after theone-sentence summary, in
JWW.swiftx3,DXFWriter.swiftx3,Reader.swiftx2), and2x
EndOfLineComment(moved an over-length trailing comment to its own line, inDXFWriter.swiftand the test file).swiftlint'sorphaned_doc_commentfound zeroviolations; no doc comments needed moving or deleting.
writing-stylepolicy ("clear them from any file you are already editing"). No file wasopened solely for this; it rode along with files already being formatted for the sweep.
Explicitly out of scope here (see #9):
clang-format(zero first-party C++ in thisrepo, confirmed), and the Swift-symbol docs-drift checks proposed for
OCCTSwiftin thewider proposal, same scoping
OCCTSwiftScripts#114used.Zero behavior change. Every edit is formatting or doc-comment structure only; no
renames, no signature changes. Verified directly, not just asserted:
swift-format lint --strictandswiftlint lint --strictboth pass locally with zeroviolations.
Scripts/comment-ratio-check.shpasses (no file at or above the 1.0x threshold).swift buildandswift testboth run before AND after the sweep: identical resultboth times, build succeeds, all 5 tests in
SwiftJWWTestspass.Package.resolvedexists in this repo (no dependencies), so nothing to check there.Closes #9
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
SwiftJWWTestssuite rather than new tests, since there is no new behavior for a newtest to cover.
Notes for the reviewer
Per the ecosystem's own gate (no repo implements without a filed issue first), this was
filed as #9 before any of this landed. Holding for review before merge, not to merge.