Skip to content

chore(#12): roll out the ecosystem code-style policy - #13

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

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

Conversation

@gsdali

@gsdali gsdali commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

What & why

Roll out the ecosystem's code-style policy to this repo
(ecosystem docs/code-style-policy-proposal-2026-08.md),
following the reference implementation
(OCCTSwiftScripts#114 /
OCCTSwiftScripts#115). This repo is
tiny (~547 Swift lines across 4 files: Sources/SwiftMeshHeal/MeshHeal.swift,
Sources/SwiftMeshHeal/HoleFill.swift, Tests/SwiftMeshHealTests/MeshHealTests.swift), so this is
a full sweep, not a gradual exemption-manifest rollout, straight to a blocking gate.

Adds:

  • .swift-format (100 col, 4-space, the ecosystem's one deliberate divergence from Google's
    2-space default) copied verbatim from OCCTSwiftScripts, plus a full
    swift-format --in-place --recursive 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), bash to match this repo's own
    script convention (not the Python style OCCTSwift/Scripts/ uses).
  • .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
    in the gate itself.
  • okf/policies/code-style.md: linked from okf/index.md.
  • By-hand fixes for every lint-only finding swift-format --in-place could not auto-fix:
    • BeginDocumentationCommentWithOneLineSummary (15 doc comments across MeshHeal.swift and
      HoleFill.swift): inserted a blank /// line after the one-line summary sentence, moving the
      rest of the existing prose into a second paragraph. No content removed.
    • AlwaysUseLowerCamelCase (3 local renames, all inside HoleFill.swift's liepaFill, all
      call sites updated in the same function): P -> points, INF -> inf, Wt -> weightTable.
      Local-only, no public API surface touched.
    • EndOfLineComment (1 finding, Tests/SwiftMeshHealTests/MeshHealTests.swift): moved a
      trailing comment that exceeded the line length onto its own line above the statement.
    • Em-dashes: every em-dash in the two touched source files was replaced with plain punctuation
      (colon, comma, or a second sentence), per the ecosystem's writing-style policy, since these are
      files this PR edits directly.

Explicitly out of scope (see #12):
clang-format (zero first-party C++ bridge files in this repo, confirmed), and any new docs-drift
tooling beyond what this repo's existing docs-current/context-first policies already cover.

Zero behavior change. Renames are local-only; everything else is formatting/doc-comment
restructuring plus the public access modifier moving from the extension declaration to each
member (swift-format's NoAccessLevelOnExtensionDeclaration rule), which does not change the
public API surface. Verified directly, not just asserted:

  • swift build and swift test: identical result before and after this sweep (build succeeds,
    7/7 tests pass).
  • swift-format lint --strict and swiftlint lint --strict: both report zero violations.
  • Scripts/comment-ratio-check.sh: no files at or above the 1.0x threshold.
  • No Package.resolved was created or touched (this package has no external dependencies).

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
    MeshHealTests suite (7/7 passing, identical before and after) 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
#12 before any of this landed. Holding
for review before merge.

Closes #12

🤖 Generated with Claude Code

Full sweep, not a gradual manifest: this repo is small enough (~547 Swift
lines across 4 files) to fully sweep into compliance in one PR, same as
OCCTSwiftScripts#115.

Adds:
- .swift-format (100 col, 4-space) + a full swift-format --in-place sweep of
  Sources/ + 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.
- okf/policies/code-style.md, linked from okf/index.md.
- Hand fixes for every lint finding swift-format --in-place could not
  auto-fix: BeginDocumentationCommentWithOneLineSummary (blank /// line
  after the one-line summary, 15 doc comments across both source files),
  AlwaysUseLowerCamelCase (3 local renames in HoleFill.swift's liepaFill:
  P -> points, INF -> inf, Wt -> weightTable; local-only, all call sites
  updated), EndOfLineComment (1 comment moved to its own line in the test
  file).
- Em-dashes removed from every line touched in Sources/ (writing-style
  policy), replaced with plain punctuation.

Zero behavior change: swift build / swift test verified before and after,
identical result (build succeeds, 7/7 tests pass). swift-format lint
--strict and swiftlint lint --strict both report zero violations.

Closes #12

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@gsdali
gsdali merged commit 477c0d3 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.

Roll out ecosystem code-style policy (swift-format + SwiftLint + comment-ratio nudge)

1 participant