Inflections are generated in one direction, so an inflected file name is never carried by its stem
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 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,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
docs: Google Safe Browsing flags go-bonnie.dev as "deceptive" (pipe-to-shell install instructions)未关闭documentation
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
[Bug]: Telegram bot (v3.11.0): "Ban log" no longer sends the current 3xipl-banned.log可能已有人在做 @HamedSanaei 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 3 天内回复
-
bug(tool/internal/instrument): identical inject_code rules from two rule packages are applied twice未关闭
难度 2/5 1-3 小时 新手友好度 76/100
open-telemetry/opentelemetry-go-compile-instrumentation#1611 ·
维护者通常 2 天内回复