Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Inflections are generated in one direction, so an inflected file name is never carried by its stem

已关闭
#64 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
go
领域
tooling

调研方向

从 namespace.Contains 和屈折形式生成逻辑开始,然后使用 internal/ssa/tracing.go 以及 issue 中的 tracing/tracer 示例重现该行为。将现有的 vocabulary workaround 与提议的行为进行比较,并确定应如何处理等价的动词形式。完成的标准是:同一个动词族得到一致处理,同时不会让 story 之类的不相关名称与 store 匹配。

由索引模型根据 Issue 内容生成。

描述

Inflected forms are generated from the namespace, and only ever longer ones. A namespace that is itself an inflected form is never carried by its own stem, so the verdict depends on which form the file name happens to use.

store.go    storingThing   carried
storing.go  storeOther     not carried

trace.go    tracingZ       carried
trace.go    tracerW        carried
tracing.go  traceX         not carried
tracing.go  tracerY        not carried

Every pair above is the same English verb. The rule separates them on nothing an author would recognise as a rule.

Where it came from

namespace.Contains allows the namespace anywhere in the name, with a free right edge. That covers a name longer than the namespace: store is a prefix of storing, so storingThing carries it without any generation at all.

Generation exists for the two inflections that change the namespace's own spelling, store to storing and apply to applies. It is built from the namespace side on purpose, so that only constructed forms are accepted and story never carries store.

That decision is still right. The gap is that generation only ever lengthens. Nothing produces trace from tracing, and the free right edge cannot help, since the namespace is the longer string.

This is real, not hypothetical

zerologlintctx has internal/ssa/tracing.go, whose declarations are tracerType, tracerEvent, traceValue, traceCommon, tracePhi. Under qualify: ondemand the file is asked for tracingTracerType and tracingTraceValue, which stutter. Renaming the file to tracer.go silences five of them and leaves the trace* ones, so the file name decides how much stuttering is demanded.

Options

Generate the stem as well. Reversing the e-drop turns tracing into trace, and that is the answer here. It is also how ring becomes r and string becomes str, so it needs a guard beyond stripping ing, and any guard is a rule about English rather than about Go.

Leave it to rules.naming.vocabulary. One line covers the case, and the free right edge makes it reach the whole family:

rules:
  naming:
    vocabulary:
      tracing: [trace]

This works today. It asks the author to notice a distinction that has no reason behind it, which is the part worth fixing.

Report it. A namespace the generator can recognise as an inflected form could carry a note in the diagnostic, pointing at the vocabulary key rather than at a rename that stutters.

Note

The rule is off by default, so nothing is broken for a project that has not opted in. What the vocabulary covers, it covers well. The asymmetry is the defect: two files spelled by the same verb are treated differently, and the author has no way to predict which one is which.

主要语言
Go
星标
50
派生
1
平均合并
57 分钟
30 天内合并 PR
135

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。