Skip to content

Roll out ecosystem code-style policy: swift-format + SwiftLint + comment-ratio check #12

Description

@gsdali

What

Roll out the ecosystem's proposed code-style policy to this repo, following the pattern already
proven in OCCTSwiftScripts#114 /
#115 (the reference implementation
for a repo this size): a full sweep, not a gradual exemption manifest.

Proposal doc: ecosystem docs/code-style-policy-proposal-2026-08.md

Scope for this repo

  • .swift-format (100 col, 4-space, copied verbatim from OCCTSwiftScripts) +
    .swiftlint.yml scoped to only_rules: [orphaned_doc_comment] (avoids fighting swift-format's
    own formatting opinions and the ecosystem's separate code-structure policy).
  • Scripts/comment-ratio-check.sh: report-only nudge (never fails), bash to match
    OCCTSwiftScripts's own convention.
  • A full sweep: swift-format format --in-place --recursive across Sources/ and Tests/
    (~4,989 lines, ~56 files across the layered OCCTSwiftUX/Resolver/Model/Kit/
    ViewportBridge/ViewportService targets), then hand-fix every remaining
    swift-format lint --strict / swiftlint lint --strict finding until both report zero.
  • .github/workflows/code-style.yml: new blocking CI job (swift-format lint --strict +
    swiftlint lint --strict blocking, comment-ratio report-only). This repo has no
    .github/workflows/ today, so this bootstraps CI from nothing.
  • okf/policies/code-style.md, linked from okf/index.md, the 7th policy in this repo's OKF
    bundle (alongside code-structure, context-first, docs-current, issue-tracking,
    search-before-building, writing-style).

Explicitly out of scope here

  • clang-format — zero first-party C++ bridge files in this repo (confirmed).
  • Any docs-drift tooling beyond the comment-ratio nudge — out of scope for this pass, matching
    OCCTSwiftScripts#114's own scoping.

Process

Filed per the ecosystem policy's own gate: no repo implements without a filed issue first. PR to
follow, referencing this issue. Holding for review before merge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions