Skip to content

chore(#13): roll out ecosystem code-style policy (full sweep) - #14

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

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

Conversation

@gsdali

@gsdali gsdali commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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

Adds:
- .swift-format (100 col, 4-space, copied verbatim from OCCTSwiftScripts,
  the ecosystem's reference implementation for this policy) + a full
  swift-format --in-place sweep of Sources/ and Tests/.
- .swiftlint.yml, scoped to only_rules: [orphaned_doc_comment]. SwiftLint's
  default rule set duplicates swift-format's formatting opinions and adds a
  code-quality/complexity surface that overlaps the ecosystem's own
  code-structure policy rather than this one.
- Scripts/comment-ratio-check.sh: report-only nudge (never fails), bash to
  match this repo's own tooling convention.
- .github/workflows/code-style.yml: swift-format lint --strict and
  swiftlint lint --strict as blocking gates, comment-ratio as a
  non-blocking step. Bootstraps CI from nothing (no prior workflow existed).
- okf/policies/code-style.md, linked from okf/index.md, this repo's 7th
  mandatory policy.
- Hand fixes for every swift-format lint --strict finding the automatic
  sweep could not fix: BeginDocumentationCommentWithOneLineSummary (7 doc
  comments split into a single-sentence summary + blank line + detail,
  matching Google's Swift Style Guide's own doc-comment structure),
  ReplaceForEachWithForLoop (2 sites in DXF.Drawing.bounds), EndOfLineComment
  (1 site moved to its own line). SwiftLint's orphaned_doc_comment already
  reported zero violations before any hand fixes were needed.
- Em-dashes removed from every file touched by the sweep, per this repo's
  own writing-style policy ("clear them from any file you are already
  editing").

Zero behavior change: formatting/doc-comment structure/CI only, no logic
touched. Verified directly:
- swift build and swift test run before and after the sweep: identical
  results both times (build succeeds, 13/13 tests pass across 2 suites,
  including the DXF_CORPUS oracle-comparison suite).
- swift-format lint --strict and swiftlint lint --strict: zero violations.
- Scripts/comment-ratio-check.sh: no files flagged.

Closes #13

🤖 Generated with Claude Code

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

1 participant