Repository navigation
v0.24.2
This release fixes the rename the naming rule suggests, and teaches the authoring skill how to change a package whose findings are baselined. What each rule reports is unchanged.
Note
The qualify message and its -fix rename change for some names. No new diagnostics appear, and no baseline keys change. A test or a script that matches the message text may need updating. The JSON output is the stable interface.
Naming rule
The suggested rename no longer doubles the words a name already shares with the end of its namespace (#360, #362). -fix applies the same rename to an unexported name.
| File | Name | Before | Now |
|---|---|---|---|
ast_function_call_expr.go |
FunctionCallExpr |
AstFunctionCallExprFunctionCallExpr |
AstFunctionCallExpr |
ast_body.go |
Body |
AstBodyBody |
AstBody |
ast_function_call_expr.go |
callExprCache |
astFunctionCallExprCallExprCache |
astFunctionCallExprCache |
Only that overlap is merged, so the name stays whole at the end and keeps its meaning. These stay as before:
| Name in namespace | Rename | Why not merged |
|---|---|---|
userLoad in userRepository |
userRepositoryUserLoad |
Putting the rest after user would change what some names say: httpServer in httpClient would read httpClientServer |
parseExpr in parser |
parserParseExpr |
parse is a different word from parser. Merging would turn setValue in settings into settingsValue |
When the merged name is already taken, the fix prefixes the whole namespace instead, and the message names that rename. For example, load and repositoryLoad in userRepository become userRepositoryLoad and userRepositoryRepositoryLoad.
Skills
The authoring skill has a new section, Changing a package that has a baseline (#361). The request decides what the agent does:
| The request | What the agent does |
|---|---|
| Add a feature or fix a bug | Keeps the package's layout. A new file follows the package's naming convention and sets //declscope:namespace. Baselined names and files stay as they are |
| Refactor some files, a part of the package, or the whole package | Follows the skill's usual rules inside that scope, and nowhere else. Fixes the findings the refactoring brings back, then drops the settled entries with declscope baseline -merge |
| Introduce declscope, or clear the whole repository's baseline | Follows the adoption skill |
| Situation | Guidance |
|---|---|
| A new name cannot carry an existing file's namespace | Propose a namespace for that file to the owner, and wait. With the owner's agreement, that file becomes a refactoring |
A Go idiom never spells the file's name, such as WithTimeout in options.go |
Propose a vocabulary entry: options: [with] |
| The owner declines | Ask the owner to choose a new file with its own namespace, or a //declscope:ignore qualify with a reason |
| Nobody can answer, as in a non-interactive run | Leave that part undone, and put the question in the report |
Install
mise use "github:mpyw/declscope@0.24.2"Full changelog: v0.24.1...v0.24.2