Skip to content

Roll out code-style policy CI: swift-format + SwiftLint + comment-ratio check #53

Description

@gsdali

What

Roll out the ecosystem's proposed code-style policy here, following OCCTSwiftScripts as the
reference implementation for a repo this size (small: full sweep, not a gradual manifest).

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

Precedent: OCCTSwiftScripts#114
(tracking issue) and OCCTSwiftScripts#115
(the PR that did the sweep); this repo repeats that pattern exactly.

Why full sweep, not a manifest

This repo is small: ~2,280 Swift lines across ~19 files (Sources/OCCTSwiftTools +
Tests/OCCTSwiftToolsTests), all pure Swift, zero first-party C++ bridge files. Small enough to
sweep into full compliance in one PR and go straight to a blocking gate, the same reasoning
OCCTSwiftScripts#114 used, rather than needing OCCTSwift's gradual "if you touch it, you fix it"
exemption-manifest approach.

Scope for this repo

  • .swift-format (100 col, 4-space) + .swiftlint.yml (scoped to avoid fighting swift-format:
    orphaned_doc_comment on, formatting-overlap rules off): copied verbatim from
    OCCTSwiftScripts.
  • A comment:code ratio check, Scripts/comment-ratio-check.sh (bash, report-only, never fails),
    matching OCCTSwiftScripts' own convention. This repo has no Scripts/ directory today, so this
    bootstraps one.
  • A full sweep of Sources/ + Tests/ into compliance in the same PR (swift-format --in-place --recursive, plus hand-fixes for lint-only findings neither tool auto-fixes).
  • A new blocking CI job, .github/workflows/code-style.yml, wiring swift-format lint --strict
    and swiftlint lint --strict as blocking gates and the comment-ratio check as non-blocking.
    This repo has no CI today, so this bootstraps CI from nothing.
  • okf/policies/code-style.md, linked from okf/index.md, bumping the mandatory-policy count
    from six to seven (this repo's OKF bundle currently lists: context-first, docs-current,
    writing-style, search-before-building, code-structure, issue-tracking).

Explicitly out of scope here

  • clang-format: no first-party C++ bridge files in this repo (confirmed: zero .cpp/.mm/
    .h/.hpp under Sources/Tests), despite "bridge" being in the repo's own description
    (bridge layer between the OCCTSwift kernel and the OCCTSwiftViewport renderer); it is a pure
    Swift bridge, no C++ involved.
  • The Swift-symbol docs-drift checks (check-docs-completeness.py etc.) proposed for OCCTSwift
    in the wider proposal: out of scope for this pass, same as OCCTSwiftScripts#114.

Process

Filed per the ecosystem policy's own gate: no repo implements without a filed issue first. PR to
follow, referencing this issue. Zero behavior change intended: formatting/doc-comment/CI only.
Hold 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