Skip to content

style(#942): fix Shape+Modeling.swift's 32 swift-format doc-comment violations, unblocking main's code-style - #945

Merged
gsdali merged 1 commit into
mainfrom
fix/942-shape-modeling-doc-comments
Aug 18, 2026
Merged

style(#942): fix Shape+Modeling.swift's 32 swift-format doc-comment violations, unblocking main's code-style#945
gsdali merged 1 commit into
mainfrom
fix/942-shape-modeling-doc-comments

Conversation

@gsdali

@gsdali gsdali commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

What & why

main has been red on code-style since PR #940, which removed
Sources/OCCTSwift/Shape+Modeling.swift from Scripts/style-manifest-swift.txt after running the
formatter. The formatter does not touch documentation-comment rules, so the file left the
manifest still failing the linter, and every push to main since has failed the job. This
fixes the doc comments, which is the only route: the manifest is a ratchet, and
check-style-manifest.py correctly refuses to have the file added back.

Measured at origin/main, swift-format lint --strict --configuration .swift-format reports 32
violations on the file, not the 24 the issue counted. The extra eight are the same two rules and the
same shapes; the issue's tables list a subset with "examples". After this PR the file reports zero,
and so does the whole non-manifest set that CI lints.

BeginDocumentationCommentWithOneLineSummary (27). Either a summary with no terminating period,
or a summary paragraph holding more than one sentence, which the rule wants split with a blank
comment line after the first. No wording was dropped; the second sentence onward moved into its own
paragraph and was rewrapped to the 100-column limit.

ValidateDocumentationComments (5).

symbol what was wrong what it says now
wedge(dx:dy:dz:xmin:zmin:xmax:zmax:) seven parameters documented as two grouped entries (- dx, dy, dz: and - xmin, zmin, xmax, zmax:), which matches no parameter one entry per parameter
wedge(at:direction:dx:dy:dz:ltx:) no Returns: A wedge solid, or nil on failure.
localLinearForm(direction:from:to:) documented from/to, the argument labels; the rule matches the parameters' own names start/end, each noting the label it is passed under
buildWires(faceIndex:) no Returns: The wires built from those edges, or nil on failure.
splitByWireOnFace(_:faceIndex:) no Returns: The shape with that face split by the wire, or nil on failure.

The advanced wedge's per-parameter text is taken from OCCT's own header, which documents that
constructor as "Make a wedge. The face at dy is xmin,zmin xmax,zmax"
(BRepPrimAPI_MakeWedge.hxx), rather than invented to satisfy the linter. That localLinearForm
wants the internal names was measured, not assumed: a two-function probe under this repo's
.swift-format flags the label-documented version and passes the name-documented one.

The two sites the issue reads as damaged

The issue reads line 1255 (splitWithFullHistory) and line 3326 (GlueMode.asBooleanGlue) as
having had their symbol references erased, leaving text that says nothing. The source was never
damaged.
swift-format strips inline code spans and doc links when it renders a diagnostic
message, so `self`, `tool`, ``Shape/BooleanGlue``, `internal` and the rest come
out as empty gaps in the message text. The gaps are in the diagnostic, not in the file. At
origin/main the two sites read, in full:

/// Split `self` by `tool` (BRepAlgoAPI_Splitter). The pieces are the
/// top-level children of the compound result; query history per input
/// sub-shape via `history.record(of:)`.
/// Case-name mapping to ``Shape/BooleanGlue`` — deliberately not a raw-value cast, since
/// the two enums' raw values disagree (see ``GlueMode``'s doc comment). `internal`, not
/// `private`, so `Issue832BooleanDelegationTests` (`@testable import`) can assert the
/// mapping directly rather than only through an OCCT result that may not observably depend
/// on glue mode for simple, already-coincident geometry.

Both are ordinary multi-sentence summaries and got the ordinary fix: a blank comment line after the
first sentence. Nothing was reconstructed and no reference was invented, so git log -S archaeology
was not needed. Worth recording, because the same misreading is available to anyone reading a
future swift-format message: the rule quotes plain text, so any summary built around a symbol
reference will look gutted in the diagnostic.

CHANGELOG entry

None. Documentation-comment wording and layout only, with no observable change to the API, its
behaviour, or its published reference docs. The user-visible effect is that main's code-style
job goes green again.

SemVer impact

NONE. Doc comments only: no declaration, signature, default value or behaviour changes, so a
consumer's build is bit-identical. Nothing to migrate.

Checklist

  • New or changed behavior is covered by a unit test in the same PR (not just manual
    verification). No behaviour changed, so no test is added. The detector for this change is
    swift-format lint --strict itself, and it is run by CI on every push.
  • Every new test and every new --self-test case was run once with its subject broken, and the
    failure is reported here. No new test or self-test. The equivalent evidence is that the check
    was watched failing before the fix and passing after: 32 errors at origin/main, 0 after,
    with the full before-list captured while working.
  • The CHANGELOG entry above is complete, and docs/CHANGELOG.md is not in this diff.
  • The SemVer impact above is stated, and docs/SEMVER.md is not in this diff.

Notes for the reviewer

Scope, deliberately narrow. Every changed line is a /// line:
git diff -U0 | grep '^[+-]' | grep -v '^[+-] *///' returns nothing. No logic, signature or call
site was touched, and no .mm file was touched, so this should auto-merge with PR #944 (which edits
.bounds call sites in the same file) and with #794's bridge work.

Scripts/style-manifest-swift.txt is untouched. The file is already off it, and per
okf/policies/code-style.md a file that has left the manifest complies rather than being
re-listed.

Em-dashes: three cleared, 47 left. okf/policies/writing-style.md asks that em-dashes be
cleared from a file being edited. The three inside doc comments this PR rewrites are gone
(helicalSweep, solidWithFullHistory, GlueMode.asBooleanGlue). The other 47 sit in doc blocks
this PR has no other reason to open; sweeping them would multiply a doc-comment diff that is
deliberately kept narrow to auto-merge with #944, and it would not change what code-style reports,
since swift-format has no opinion on em-dashes. Left for a dedicated pass.

Verification, all local, all from the repo root:

check result
swift-format lint --strict on the file clean (was 32 errors)
CI's own step: swift-format lint --strict over every non-manifest Sources/OCCTSwift file clean
swiftlint lint --strict --config .swiftlint.yml 0 violations, 223 files
check-style-manifest.py --self-test / --base origin/main 6/6 cases, clean
comment-ratio-check.py --self-test / bare 5/5 cases, report-only as designed
all fourteen gate-scripts invocations from ci.yml every one exit 0
swift build (OCCTSWIFT_LOCAL=1, local kernel) Build complete

…ng.swift

PR #940 removed this file from Scripts/style-manifest-swift.txt after running the
formatter, but the formatter does not fix documentation-comment rules, so main has
been red on code-style since it merged. `swift-format lint --strict` reports 32
violations on the file at origin/main, not the 24 the issue counted.

BeginDocumentationCommentWithOneLineSummary (27): a missing terminating period, or
a summary paragraph holding more than one sentence, which needs a blank comment
line after the first.

ValidateDocumentationComments (5): the advanced `wedge` documented its seven
parameters as two grouped entries; `localLinearForm` documented `from`/`to`, the
argument labels, where the rule matches the parameters' own names `start`/`end`;
`wedge(at:direction:...)`, `buildWires` and `splitByWireOnFace` had no `Returns:`.

The advanced wedge's per-parameter text comes from OCCT's own header, which
documents the constructor as "Make a wedge. The face at dy is xmin,zmin xmax,zmax",
not from invention.

The issue reads two sites (the `splitWithFullHistory` and `GlueMode.asBooleanGlue`
summaries) as having had their symbol references erased. They had not: swift-format
strips inline code spans and doc links when it renders a diagnostic message, so the
gaps are in the message, not the source. Both are ordinary two-sentence summaries.

Three em-dashes are gone from the doc comments this touches, per
okf/policies/writing-style.md. Doc comments only: no logic, signature or call site
changes, so every changed line is a `///` line.

Closes #942

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kilo-code-bot

kilo-code-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • Sources/OCCTSwift/Shape+Modeling.swift

Reviewed by nemotron-3-ultra-550b-a55b:free · Input: 203.8K · Output: 3.9K · Cached: 803.7K

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