Skip to content

chore(#9): roll out ecosystem code-style policy - #10

Merged
gsdali merged 1 commit into
mainfrom
chore/9-code-style-sweep
Aug 12, 2026
Merged

chore(#9): roll out ecosystem code-style policy#10
gsdali merged 1 commit into
mainfrom
chore/9-code-style-sweep

Conversation

@gsdali

@gsdali gsdali commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What & why

The second pilot repo for the ecosystem's proposed code-style policy
(ecosystem docs/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 from
    Google's own 2-space default), copied verbatim from OCCTSwiftScripts, plus a full
    swift-format --in-place sweep of Sources/ + Tests/.
  • .swiftlint.yml, deliberately narrow (only_rules: [orphaned_doc_comment]). SwiftLint's
    default 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, ...) that
    overlaps the ecosystem's own code-structure policy rather than this one. Scoped down to
    the one rule that catches something swift-format has no equivalent for.
  • Scripts/comment-ratio-check.sh: report-only nudge (never fails), matching this repo's
    own bash-script convention.
  • .github/workflows/code-style.yml: swift-format lint --strict and
    swiftlint lint --strict as blocking gates, comment-ratio as a non-blocking step. Pure
    text analysis, no swift build needed. This repo had no .github/workflows/ before this
    change, so this bootstraps CI from nothing.
  • okf/policies/code-style.md: this repo's 7th mandatory policy, linked from
    okf/index.md.
  • 10 by-hand fixes for lint-only findings swift-format --in-place can't auto-fix:
    8x BeginDocumentationCommentWithOneLineSummary (blank /// line inserted after the
    one-sentence summary, in JWW.swift x3, DXFWriter.swift x3, Reader.swift x2), and
    2x EndOfLineComment (moved an over-length trailing comment to its own line, in
    DXFWriter.swift and the test file). swiftlint's orphaned_doc_comment found zero
    violations; no doc comments needed moving or deleting.
  • Cleared pre-existing em-dashes from every file touched in this PR, per the ecosystem's own
    writing-style policy ("clear them from any file you are already editing"). No file was
    opened 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 this
repo, confirmed), and the Swift-symbol docs-drift checks proposed for OCCTSwift in the
wider proposal, same scoping OCCTSwiftScripts#114 used.

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 --strict and swiftlint lint --strict both pass locally with zero
    violations.
  • Scripts/comment-ratio-check.sh passes (no file at or above the 1.0x threshold).
  • swift build and swift test both run before AND after the sweep: identical result
    both times, build succeeds, all 5 tests in SwiftJWWTests pass.
  • No Package.resolved exists in this repo (no dependencies), so nothing to check there.

Closes #9

Checklist

  • New or changed behavior is covered by a unit test in the same PR (not just manual
    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
    SwiftJWWTests suite rather than new tests, since there 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 #9 before any of this landed. Holding for review before merge, not to merge.

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>
@gsdali
gsdali merged commit 1b642d8 into main Aug 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: roll out ecosystem code-style policy (swift-format + SwiftLint + comment-ratio check)

1 participant