Skip to content

v0.26.0

Latest

Choose a tag to compare

@github-actions github-actions released this 24 Nov 17:10
· 1 commit to main since this release
Immutable release. Only release title and notes can be modified.
b94889b

This release withholds more fixes that compiled but changed what a program does or reports, and fixes two ways a rules.naming.vocabulary key was read wrong. Most of the fixes come from a review of the formal specs against the code.

Caution

Behavior changes

  • Two vocabulary keys that name the same namespace are a config error (#437). userId and user_id in one file are refused, with both keys named. Keep one.
  • A vocabulary key is read as a namespace (#437). userId, user_id and userid all reach the userID namespace of user_id.go. Before, only the exact spelling userID worked, and any other spelling was ignored in silence.
  • An empty or null vocabulary namespace inherits the outer file's words (#435). mouse: [], mouse: ~ and a bare mouse: used to wipe them.
  • inspect reports names[].fixable: false for a name the baseline records (#434).

Renames that are withheld now

With rules.naming.fix: true, these renames compiled but changed what the program does, or what the next run reports. Each is now withheld. The report is still made.

Case What went wrong PR
The baseline records the old name, or a member of the type under it The next run reported what the baseline hid #434
A value of the type can reach an interface xml.Marshal, %T, %+v and gob saw the new name. <point> became <userPoint>, and a stored gob value no longer decoded #438
A build-excluded file binds the name with //go:linkname or //export The build that keeps the file failed #408

A type whose value reaches an interface includes one a slice, map or embedding holds, and one an exported declaration hands out, since an importer can print it.

shrink

What was wrong Now PR
-fix unexported a name that the baseline records The fix is withheld: (no fix: the baseline records it) #434
A package under testdata/, _x/, .x/ or a go.mod ignore directory could use a name, and -fix broke it The report stays, with (no fix: a file in a directory ./... skips uses it) #412
The same, under a vendor/ directory below the module root Read the same way. Only a module's root vendor/ is skipped #436
An example function in a build-excluded test file of the package named the declaration The fix is withheld #416
Assembly in another package read a variable by its symbol It counts as a use #409
A type returned by a function that only a build-excluded file calls could not be ignored in a way that passes every configuration The type reads as used there #403
A build-excluded external test file was read as another package It is read as an external test #413
A const value held by its block did not read as taken when another fix took its name The report no longer changes after -fix #415

Other fixes

What was wrong Now PR
surplus: strict narrowed a type over a member's own //declscope:private, and -fix created a new report The type's fix is withheld #410
An ignore of surplus passed one build configuration and failed the other It passes both #411
A field filled by position through a named slice, array or map in a build-excluded file lost its boundary ignore It is kept #414
The test and non-test variants disagreed about a type, and both the type's and its member's boundary fixes were written The member's fix waits for the variant that sees every file #421

In each case of a withheld fix, the report is still made.

Known limit

Two files under opposite constraints, such as gui and !gui, that both use a member keep its //declscope:ignore overexported although every configuration uses it. shrink does not solve build constraints, so delete such an ignore by hand (#433).

Skills

  • naming.md: a vocabulary key can be spelled like the file name (#437).
  • declscope-authoring: a reason may name the files that read a declaration when they are few. The core is no longer offered as the place to drop a prefix (#397).

Upgrading

Who Do
Has two vocabulary keys for one namespace Keep one
Relied on mouse: [] to clear an outer file's words Change the outer file instead
Runs -fix with rules.naming.fix: true Expect fewer renames. The reports stay
Everyone else Nothing

Specs

The formal specs no longer count a property that only restates its definition as proof (#422). Restatements were deleted or kept as lemmas, and each spec states claims a wrong rule breaks, checked with mutants. unused_bind was folded into unused_modes, and surplus, rename_sound and rename_siblings were deleted. 21 specs are proved by induction. No public API changes.

Install

mise use "github:mpyw/declscope@0.26.0"

Full changelog: v0.25.0...v0.26.0

Changelog

  • 8c7c899 chore(deps): Bump golang.org/x/mod (#396)
  • 390d24c ci: describe the spec gate as it is now (#432)
  • 8359aa4 docs(shrink): state that files under opposite constraints keep a stale ignore (#433)
  • 41feaee docs(skills): name the reading files in a reason when few, and stop offering the core as a place to drop a prefix (#397)
  • 69aea31 fix(config): read a vocabulary key as a namespace (#437)
  • 68789f5 fix(config): treat an empty or null vocabulary namespace as unstated (#435)
  • b5b26a5 fix(rename): withhold a type's rename when a value of it can reach an interface (#438)
  • 09e648c fix(shrink): count a name assembly in another package spells as a use (#409)
  • bc4634c fix(shrink): read a build-excluded external test file as an external test (#413)
  • a20511c fix(shrink): read a held const value as taken when another fix takes its name (#415)
  • 2c3a260 fix(shrink): read a type an excluded file reaches through a carrier as used (#403)
  • 8ac7939 fix(shrink): read a vendor directory below the module root as one ./... skips (#436)
  • 7cf8dde fix(shrink): withhold the fix of a name an excluded example function names (#416)
  • bd5955b fix(shrink): withhold the fix of a name only a directory ./... skips uses (#412)
  • 314fc25 fix(surplus): withhold strict's type fix over a member's own //declscope:private (#410)
  • 46fedee fix(unused): keep an ignore of surplus while a build-excluded file stands the rule down (#411)
  • 788f4b7 fix(unused): read a field filled through a named slice, array or map in a build-excluded file (#414)
  • 8915b87 fix: defer a member's boundary fix to the variant that sees every file (#421)
  • da652e4 fix: withhold a renaming fix while the baseline records the name (#434)
  • ed42ef6 fix: withhold the rename of a name a build-excluded file links by directive (#408)
  • 5f08d73 refactor(spec): plain names, one statement per line and short comments in the naming, filter and config specs (#399)
  • 52f46dd refactor(spec): plain names, one statement per line and short comments in the rename specs (#398)
  • 4608899 refactor(spec): plain names, one statement per line and short comments in the scope specs (#401)
  • 0e04273 refactor(spec): plain names, one statement per line and short comments in the shrink specs (#400)
  • eb26ae5 refactor(spec): plain names, one statement per line and short comments in the surplus and unused specs (#402)
  • 9410cf1 spec(shrink): replace restatements with independent claims in the shrink specs (#428)
  • 8ed77e2 spec: delete rename_sound, rename_siblings and surplus (#430)
  • 4c0a0c4 spec: drop restatements from filter and filter_chain, state monotonicity (#424)
  • 2be6320 spec: fold unused_bind into unused_modes and state independent claims (#427)
  • e08930d spec: independent claims for the scope model in knobs, boundary_fix and fix_members (#431)
  • be40751 spec: pin guards that hand mutants showed nothing checks (#420)
  • 6fcb313 spec: replace restated properties in config_inherit and unused_ignore (#426)
  • 14c3373 spec: replace restatements in surplus_strict and type_fix_members (#425)
  • b6f5783 spec: state the naming and boundary-off claims instead of restating guards (#429)
  • 9461ddc spec: state the two-run claims of unused_ignore_unseen and shrink_ignore (#423)