Skip to content

scripts and templates: fifteen small SonarCloud maintainability findings outside PR #112 sit unfixed on main #118

Closed

Description

@brettheap

Lane: openreposhape-2 (openRepoShape-2)

What is wrong. SonarCloud's MAINTAINABILITY tail on main (cd57c4b) carries
fifteen small findings in files PR #112 (feat/shape-tool-commit-trailers)
does not touch. None share a cause; each is named here with the rule id, the
file:line, and the evidence read directly off main.

  1. python:S1192 (duplicated literal) — scripts/render-cli-reference.py:161
    and :176: "an assembly root" appears three times (161, 166, 171) and
    "a family holder" three times (176, 182, 187), each as a bare literal in
    a Tool(...) row's installed_in field.
  2. python:S1192 — scripts/repo_shape.py:430 [PINNED]: the sentinel
    "\x00BLOCK\x00" is spelled out three times (430, 450, 467) across
    _tokenise, _parse_sequence and _parse_mapping.
  3. python:S1172 (unused parameter) — setup-project.py:1643: shape_root
    in def clone_and_bootstrap(opts, shape_root, org, landing) is never read
    in the function body.
  4. python:S1172 — templates/assembly-root/scripts/bootstrap.py:228
    [PINNED]: manifest in
    def read_authority(root, manifest, legs) is never read in the body.
  5. python:S1172 — templates/family-root/scripts/validate-family.py:291
    [PINNED]: root in
    def _check_member_identity(root, member, row, project, report) is never
    read in the body.
  6. python:S3358 (ternary nested inside a ternary) —
    scripts/repo_shape.py:1111
    [PINNED]: reason=f"declared pin chain {rendered}" + (f" ({len(unverified)} link" + ("" if len(unverified) == 1 else "s") + " declared-unverified)" if unverified else "").
  7. python:S3358 — scripts/validate-repository-naming.py:366 [PINNED]:
    label = "NO FAMILY" if not found else (found[0] + (f"/{found[1]}" if found[1] else "")).
  8. python:S3358 —
    templates/assembly-root/scripts/validate-manifest.py:216 [PINNED]:
    + (f" (directly or through {CHAIN_RECORD_FIELD})" if satisfied is None else (f" through the recorded chain {' → '.join(resolution.chain)}" if resolution.by_chain else " directly")).
  9. python:S3457 (f-string with no replacement field) —
    scripts/bump-leg.py:513: the Refusal(...) call's third argument is one
    string literal formed by implicit concatenation across lines 513-516;
    Sonar reports it at its start line (513), and the segment actually
    carrying the redundant f prefix is line 515,
    f"add\ mounted it once; restore that commit, or re-scaffold. "— no{}` appears anywhere in the merged literal.
  10. python:S3457 —
    templates/assembly-root/scripts/bootstrap.py:147 [PINNED]: the same
    shape — one merged literal across lines 147-149 (print(f"... three
    times over), reported at its start line, with no {} anywhere in it.
  11. python:S5713 (redundant exception class already covered by a caught
    parent) — scripts/repo_shape.py:653 [PINNED]:
    except (FileNotFoundError, OSError): — FileNotFoundError is already
    an OSError subclass
    (issubclass(FileNotFoundError, OSError) is True).
  12. python:S1845 (member names differing only by case) —
    scripts/repo_shape.py:825: the property reached and the class
    attribute REACHED (line 813) on ReferentResolution.
  13. python:S6353 (character class equivalent to a predefined one) —
    templates/family-root/scripts/siblings.py:157 [PINNED]:
    MAKE_ASSIGNMENT_RE = re.compile(r"[A-Za-z_][A-Za-z0-9_]*=[^\x00-\x1f\x7f]*")
    — Sonar's suggestion is that the [A-Za-z0-9_]* half is exactly what
    \w* matches.
  14. python:S7632 (malformed issue-suppression comment) —
    setup-project.py:1430:
    except Exception: # noqa: BLE001 - advice, not a gate; see above.
  15. javascript:S7761 (prefer .dataset over getAttribute) —
    docs/handbook.html:1749 and :1751:
    tab.getAttribute('data-platform') and
    el.getAttribute('data-platform'), both inside the tab-switching
    <script>.

What would fix it.

For 1-2: a named module constant per repeated literal (_BLOCK_SENTINEL in
repo_shape.py; INSTALLED_IN_ASSEMBLY_ROOT / INSTALLED_IN_FAMILY_HOLDER
in render-cli-reference.py), used everywhere the literal appeared.

For 3-5: drop the unused parameter from the signature and from its one call
site — each of the three has exactly one definition and exactly one caller,
both inside the same file, confirmed by
grep -rn '<name>(' --include='*.py' . across the whole repository
(including templates/ and tests/); none is a public interface another
file or another project's own code calls by name.

For 6-8: turn the nested ternary into an independent statement — an
if/else (6, 7) or if/elif/else (8) that assigns a plainly-named local
(unverified_note, role_suffix inside label's own branch, how_reached)
before the surrounding expression uses it, exactly as this codebase already
does one line above finding 6
(status = CHAIN_UNVERIFIED if unverified else "verified").

For 9-10: drop the redundant f prefix from the segment(s) that carry no
{} — the adjacent segments that do interpolate (e.g. f"{repository} has no branch containing {commit}" two lines above finding 9) are untouched.

For 11: catch OSError alone.

For 12 — declined. reached has exactly three callers repo-wide
(confirmed by grep -rn '\.reached\b' --include='*.py' .):
scripts/repo_shape.py:1249 (this file, harmless to rename), but also
scripts/shape_materialize.py:495 — a file this pass must not touch, because
PR #112 rewrites it and its Sonar rows explicitly wait for that later pass —
and templates/assembly-root/scripts/validate-manifest.py:203, a second,
unrelated line in a digest-pinned file this issue already touches only at its
one flagged line (finding 8). repo_shape.py is itself copied verbatim into
every scaffolded project's scripts/ directory and recorded by sha256 in
that project's contracts/shape-pin.yaml (see the file's own module
docstring), so ReferentResolution is a shipped interface a project's own
code could reference, not a name private to one file. A rename here ripples
into an excluded file and a second untouched line of a pinned one — exactly
the two conditions this fan-out's brief says to decline on.

For 13 — declined. MAKE_ASSIGNMENT_RE is not compiled with re.ASCII,
and the string it validates (a --make-arg NAME=value typed by the family
holder operator on their own command line) is not provably ASCII-only.
Swapping [A-Za-z0-9_] for \w would silently admit any Unicode word
character in Python 3 — a semantic change, not a simplification — where the
comment immediately above the pattern (templates/family-root/scripts/siblings.py:153-155)
says the two patterns are deliberately narrow: "They are narrow because the
holder only ever passes one shape of either... so anything else is a mistake
worth refusing by name rather than a case worth carrying." Widening what a
make target/assignment name accepts is exactly the kind of case that comment
argues against carrying.

For 14: the malformed part is the free-text explanation riding on the same
# noqa: comment as the suppressed code. Reworded to drop the comma
(BLE001 - advice, not a gate; see above → BLE001 (advice rather than a gate; see above)), matching the shape already proven not to trip this rule
two hundred-odd lines above it, at setup-project.py:1377:
# noqa: E402 (deferred on purpose; see above) — parenthesized, no comma.

For 15: tab.dataset.platform / el.dataset.platform. Every element either
line reads is matched by a [data-platform] attribute selector
(.steps [data-platform] for platformEls, or is one of the four
[role="tab"] buttons that all carry data-platform literally in the
markup), so the attribute is always present and .dataset.platform is never
undefined where getAttribute would have returned a string.

Every "PINNED" file above is a digest-pinned copy
(scripts/repo_shape.py, scripts/validate-repository-naming.py,
templates/assembly-root/scripts/{bootstrap.py,validate-manifest.py},
templates/family-root/scripts/{validate-family.py,siblings.py}); each is
touched only at its own flagged line (plus the one same-file call-site
update findings 4-5 force), per this fan-out's rule for pinned copies.

Activity

  1. brettheap commented on Sep 11, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-11T20:28:46Z) CLAIMED — session 3b1ab8cf, on Brett Heap's word 'go, fan out on all of it'. Branch chore/sonar-maintainability-tail-outside-112, worktree ~/projects/openRepoShape--sonar-tail on Eagle, from origin/main cd57c4b. Scope: the fourteen SonarCloud maintainability findings outside PR #112's files, twelve fixed at their flagged line and two declined with reasons.

  2. changed the title [-]scripts and templates: fourteen small SonarCloud maintainability findings outside PR #112 sit unfixed on main[/-] [+]scripts and templates: fifteen small SonarCloud maintainability findings outside PR #112 sit unfixed on main[/+] on Sep 11, 2026
  3. brettheap commented on Sep 11, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-11T20:44:14Z) PULL REQUEST OPEN: #121 (head b667b4e).

  4. brettheap commented on Sep 11, 2026

    @brettheap
    ContributorAuthor

    (lane openreposhape-2 (openRepoShape-2), 2026-09-11T21:00:51Z) MERGED — #121 → e9fa826 (squash), on Brett Heap's word 'go, fan out on all of it, hold the doctor refactor'. scripts and templates: the SonarCloud maintainability tail outside PR #112's files fixed at each flagged line — S1192 literals named in render-cli-reference.py and repo_shape.py, S1172 unused parameters dropped in setup-project.py and the pinned assembly bootstrap.py / family validate-family.py with every caller updated, S3358 nested ternaries unfolded in repo_shape.py, validate-repository-naming.py and validate-manifest.py, S3457 bare f-strings, S5713 redundant except, S7632 noqa syntax, S7761 dataset in handbook.html; S1845 'reached' rename and S6353 '\w' declined with reasons; pinned copies touched: repo_shape.py, validate-repository-naming.py, assembly bootstrap.py + validate-manifest.py, family validate-family.py; Copilot 'Approval recommended' 0 findings; suite 984 passed / 1 known flake / 1 skipped. Object complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions