Skip to content

docs(skills): order declarations by reach - #188

Merged
mpyw merged 2 commits into
mainfrom
docs/order-by-reach
Oct 8, 2026
Merged

mpyw merged 2 commits into
mainfrom
docs/order-by-reach

Conversation

@mpyw

@mpyw mpyw commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Skill: declscope-authoring gains an "Order by reach" section. Within each sequence a file already has, declarations go from the widest reach to the narrowest: other packages, other files of the package, then the namespace. Scope decides the reach, not the case of the first letter.
    • The order of kinds, and each type's grouping with its constructors and methods, stay as they are. Within each reach, the existing order stays.
    • A private helper may stay right after its users when they sit next to each other. Fields have no such exception.
    • When a change moves a declaration to another reach, the declaration moves too by default, and the report says so.
    • Nothing is reordered where the order is observable. The list gains iota, const specs with the expression omitted, var initializers with side effects, and init functions.
    • The repository's linters (decorder, funcorder) take precedence. Test files and generated files are out of scope. declscope does not check this order.
  • Code: the repository's own declarations and fields are reordered to match, in 10 files. Only declarations move. No logic changes.

Verification

  • A throwaway AST checker that applies the rule above reports nothing after the reorder. It reported 39 inversions before.
  • mise x -- ./test_all.sh passes. Coverage is 99.0% in total. The spec stage was not run locally, since fslc was not on PATH.

🤖 Generated with Claude Code

mpyw and others added 2 commits October 8, 2026 09:56
Within each sequence a file already has, put declarations from the widest
reach to the narrowest: other packages, other files, then the namespace.
A private helper may stay right after its adjacent users. Fields follow
the same order with no exception. The struct field convention now points
here, and the list of observable orders gains iota, omitted const
expressions, side-effecting var initializers and init functions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Apply the authoring skill's new ordering to the repository itself. Only
declarations and fields move; no code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.96970% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.02%. Comparing base (cde3133) to head (d1a8b6b).

Files with missing lines Patch % Lines
cmd/declscope/load.go 90.00% 1 Missing ⚠️
internal/ignore.go 87.50% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #188   +/-   ##
=======================================
  Coverage   99.02%   99.02%           
=======================================
  Files          50       50           
  Lines        4214     4214           
=======================================
  Hits         4173     4173           
  Misses         41       41           
Flag Coverage Δ
unittests 99.02% <96.96%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mpyw
mpyw merged commit e95824b into main Oct 8, 2026
9 of 10 checks passed
@mpyw
mpyw deleted the docs/order-by-reach branch October 8, 2026 01:05
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