chore(#53): roll out the ecosystem code-style policy - #54
Merged
Conversation
Follows OCCTSwiftScripts#114/#115 as the reference implementation for a repo this size: full sweep, not a gradual exemption manifest. This repo is small (~2,280 Swift lines, ~19 files, 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. - .swift-format: 100 col, 4-space (the ecosystem's one deliberate divergence from Google's 2-space default), copied verbatim from OCCTSwiftScripts. - .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: 149 hits measured fresh for this repo, 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. This repo had no Scripts/ directory before; this bootstraps one. - .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. This repo had no CI before; this bootstraps CI from nothing. - okf/policies/code-style.md: 7th mandatory policy for this repo, linked from okf/index.md. - Full Sources/+Tests/ sweep: swift-format --in-place, plus by-hand fixes for the lint-only findings it can't auto-fix: doc-comment structure (BeginDocumentationCommentWithOneLineSummary, a blank `///` line after the one-sentence summary), Returns:/Throws: additions and Parameter -> Parameters: pluralization (ValidateDocumentationComments, including the internal parameter names ValidateDocumentationComments actually validates against, e.g. `bodyID`/`rgba`/`customDeflection`/`useDirectMesh` rather than their external argument labels). No AlwaysUseLowerCamelCase or EndOfLineComment findings this pass; no orphaned_doc_comment findings either. Zero behavior change: doc comments and formatting only, no signature or logic changes. - Incidental: cleared every em-dash found in every file touched by this sweep (source, tests, the new scaffold, and the one pre- existing em-dash in okf/index.md's frontmatter description), per the ecosystem's writing-style policy's own "clear them from any file you are already editing" instruction. Verified locally: swift-format lint --strict and swiftlint lint --strict both report zero violations. swift build and swift test give identical results before and after the sweep: build succeeds, 45 tests in 9 suites pass. No Package.resolved drift. Filed per the ecosystem's own gate: no repo implements without a filed issue first. Closes #53. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Rolls out the ecosystem's code-style policy
(
ecosystemdocs/code-style-policy-proposal-2026-08.md),following OCCTSwiftScripts#114 /
#115 as the reference
implementation for a repo this size: full sweep, not a gradual exemption manifest. This repo is
small (~2,280 Swift lines across ~19 files, all pure Swift, zero first-party C++ bridge files
despite "bridge" being in the repo's own description), small enough to sweep into full compliance
in one PR and go straight to a blocking gate.
Adds:
.swift-format(100 col, 4-space, the ecosystem's one deliberate divergence from Google's2-space default), copied verbatim from OCCTSwiftScripts, plus a full
swift-format --in-placesweep of
Sources/+Tests/..swiftlint.yml, deliberately narrow (only_rules: [orphaned_doc_comment]), also copied fromOCCTSwiftScripts' pattern. 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 owncode-structurepolicy rather than this one;
identifier_name's default alone produced 149 hits measured freshfor this repo (not carried over from OCCTSwiftScripts' own number), all short conventional
locals (
i,p,n,db) in dense numerical/graph code, none real problems. Scoped down tothe one rule that catches something swift-format has no equivalent for.
Scripts/comment-ratio-check.sh: report-only nudge (never fails), matching OCCTSwiftScripts'own bash-script convention. This repo had no
Scripts/directory before; this bootstraps one..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. This repo had no CI before; this bootstraps CI from nothing.
okf/policies/code-style.md: this repo's 7th mandatory policy, linked fromokf/index.md(this repo's bundle: context-first, docs-current, writing-style, search-before-building,
code-structure, issue-tracking, and now code-style).
OCCTSwiftScripts#115 hit:
BeginDocumentationCommentWithOneLineSummary: a blank///line added after theone-sentence summary in ~14 doc comments across
CADFileLoader.swift,FaceIdentityTable.swift,EdgeIdentityTable.swift,VertexIdentityTable.swift, and onetest file.
ValidateDocumentationComments:Returns:sections added toPointConverter.pointsToBody,BodyUtilities.makeMarkerSphere,SurfaceConverter.surfaceToGridBodies,WireConverter.wireToBody, andCADFileLoader.shapeToBodyAndMetadata; aThrows:sectionadded to
CADFileLoader.load; four singular- Parameter x:blocks converted to plural- Parameters:blocks (CADFileLoader.load,CADFileLoader.shapeToBodyAndMetadata,WireConverter.wireToBody), which surfaced that the plural form is validated forcompleteness against the full parameter list, by internal name where it differs from the
external label (
bodyID/rgba/customDeflection/useDirectMesh, notid/color/deflection/directMesh), not just the params that already had prose.AlwaysUseLowerCamelCaseorEndOfLineCommentfindings this pass, and noorphaned_doc_commentfindings from SwiftLint either.new scaffold files, and the one pre-existing em-dash in
okf/index.md's frontmatterdescription), per the ecosystem's writing-style policy's own "clear them from any file you are
already editing" instruction.
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, tracked separately if thisrepo's
docs/reference/(which documents Swift declarations directly, unlike OCCTSwiftScripts'CLI-verb docs) turns out to need them.
Zero behavior change. Every change is a doc comment, a formatting pass, or CI/policy
scaffolding; no function signature or logic changed. Verified directly, not just asserted:
swift-format lint --strictandswiftlint lint --strictboth report zero violations(
find Sources Tests -name '*.swift' -print0 | xargs -0 swift-format lint --strict --configuration .swift-format;swiftlint lint --strict --config .swiftlint.yml).swift buildandswift testrun before and after the sweep give identical results: buildsucceeds both times, and both times
swift testreports 45 tests in 9 suites, all passing.Package.resolveddrift from any local build/test run.Closes #53
Checklist
verification); see SecondMouseAU/OCCTReconstruct#397
for the ecosystem-wide test-coverage standard this is piloting.
N/A here: no behavior changed (formatting/doc comments/CI/policy only), verified via the
existing test suite (45/45 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
#53 before any of this landed. Holding for review before merge, not merging this myself.