chore(#114): trial the ecosystem code-style policy - #115
Merged
Conversation
Pilot repo for the ecosystem's code-style policy proposal, chosen because this codebase is small enough (48 files, ~10k lines) to sweep into full compliance in one PR and go straight to a blocking gate, rather than needing OCCTSwift's gradual exemption-manifest approach. - .swift-format: 100 col, 4-space (the ecosystem's one deliberate divergence from Google's 2-space default). - .swiftlint.yml: scoped to `orphaned_doc_comment` only via `only_rules`, not the default set. SwiftLint's defaults duplicate swift-format's formatting opinions and add a separate surface of code-quality/complexity opinions (identifier_name in particular: 548 hits on first run, all short conventional locals in dense numerical/graph code, none real problems) that belong to the ecosystem's code-structure policy, not this one. - 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. Pure text analysis, no swift build needed. - okf/policies/code-style.md: 8th mandatory policy for this repo, linked from okf/index.md and CLAUDE.md (count bumped seven -> eight, verified against Scripts/policy-check.sh). - Full Sources/+Tests/ sweep: swift-format --in-place, plus by-hand fixes for the 47 lint-only findings it can't auto-fix (doc-comment structure, two Throws: additions, one Parameters: pluralization, two snake_case->camelCase renames in Sources/Script/main.swift). Zero behavior change: renames are local-only, doc comments only. Verified locally: swift-format lint --strict, swiftlint lint --strict, comment-ratio-check.sh, and Scripts/policy-check.sh all pass. Release build succeeds; Scripts/verb-check.sh and Scripts/run-identity-check.sh both pass against it. (A plain debug `swift build` hits a pre-existing, unrelated OCCTSwift/OCCTSwiftAIS sibling-version link error, confirmed present on main before this change too via git stash; the release build CI actually uses is unaffected.) Filed per the ecosystem's own gate: no repo implements without a filed issue first. Closes #114. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Aug 12, 2026
Closed
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Pilot repo for the ecosystem's proposed code-style policy
(
ecosystemdocs/code-style-policy-proposal-2026-08.md),chosen deliberately ahead of
OCCTSwiftin the rollout order: this codebase is small (48 files,~10k lines) so it's one we can fully sweep into compliance in one PR and turn on zero-tolerance
blocking CI immediately, rather than needing OCCTSwift's gradual "if you touch it, you fix it"
exemption-manifest approach. Also the first real test of the CI gates themselves.
Adds:
.swift-format(100 col, 4-space — the ecosystem's one deliberate divergence from Google's2-space default) + a full
swift-format --in-placesweep ofSources/+Tests/..swiftlint.yml, deliberately narrow (only_rules: [orphaned_doc_comment]). SwiftLint'sdefault 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, ...) thatoverlaps the ecosystem's own
code-structurepolicy rather than this one —identifier_name'sdefault alone produced 548 hits on first run, all short conventional locals (
i,db,g,sv) in dense numerical/graph code, none real problems. Scoped down to the one rule thatcatches something swift-format has no equivalent for.
Scripts/comment-ratio-check.sh: report-only nudge (never fails), matching this repo's ownbash-script convention rather than the Python style
OCCTSwift/Scripts/uses..github/workflows/code-style.yml:swift-format lint --strictandswiftlint lint --strictas blocking gates, comment-ratio as a non-blocking step. Pure text analysis, no
swift buildneeded, so it stays cheap even on the
macos-15runner it uses for tool availability.okf/policies/code-style.md: this repo's 8th mandatory policy, linked fromokf/index.mdandCLAUDE.md(count bumped seven → eight).swift-format --in-placecan't auto-fix: doc-commentstructure (
BeginDocumentationCommentWithOneLineSummary), twoThrows:additions and oneParameters:pluralization (ValidateDocumentationComments), and two snake_case → camelCaserenames in
Sources/Script/main.swift(c_seg1..10/w_seg1..10→cSeg1..10/wSeg1..10,local-only, all call sites updated).
Explicitly out of scope here (see the issue):
clang-format(no first-party C++ in thisrepo), and the Swift-symbol docs-drift checks proposed for
OCCTSwift— this repo'sdocs/reference/documents CLI verbs, not Swift declarations, andScripts/verb-check.sh/.github/workflows/verbs.ymlalready guard that registry-vs-docs consistency.Zero behavior change. Renames are local-only; everything else is formatting/doc comments.
Verified directly, not just asserted:
swift-format lint --strict,swiftlint lint --strict,Scripts/comment-ratio-check.sh,Scripts/policy-check.shall pass locally.Scripts/verb-check.shandScripts/run-identity-check.shboth passagainst it.
swift test --filter DrawingComposerTests: 3/3 pass (covers the hand-edited files).Scripts/recipe-check.sh: all 7 recipes pass, every one with a referenceoutput.brepmatchesit at
Δvol = 0.00e+00— same geometry, byte-for-byte, before and after the sweep.One pre-existing, unrelated finding surfaced during verification: a plain debug
swift buildhitsan OCCTSwift/OCCTSwiftAIS sibling-version link error (
Face.SurfaceTypesymbol not found).Confirmed present on
mainbefore this change too (viagit stash+ rebuild). The release buildCI actually uses (
swift build -c release) is unaffected. Not fixed here, out of scope for astyle/docs pass; flagging in case it's worth its own issue.
Closes #114
Checklist
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
DrawingComposerTestssuite andrecipe-check.sh's reference-output comparison rather thannew tests, since there's 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
#114 before any of this landed. Holding for review before merge, per "we'll review and implement."
🤖 Generated with Claude Code