这种代理添加的评论类型是否有一个名称,其中泄露了提示内容?

3作者: xdennis3 天前原帖
这是一个愚蠢的例子,用来说明我的意思。假设你有以下代码:<p><pre><code> def create_background(width: int, height: int) -&gt; Image: ... </code></pre> 你告诉代理使用与 create_screen 相同的默认值来设置 create_background。它将代码改为:<p><pre><code> # 现在 create_background 的参数有了默认值,与 screen.py 中的 create_screen 相同 def create_background(width: int = DEFAULT_WIDTH, height: int = DEFAULT_HEIGHT) -&gt; Image: ... </code></pre> 这个不必要的注释是“vibed”代码的典型特征,但它的语气也让我感到烦恼,因为它没有超越提示。它根据被要求做的事情来写注释,而不是以一种超越时间的方式来表达。<p>我在代码审查中不断告诉人们要删除不必要的注释,但我觉得我缺乏足够的词汇来表达这样做的坏处。
查看原文
This is a stupid example to illustrate what I mean. Say you have this code:<p><pre><code> def create_background(width: int, height: int) -&gt; Image: ... </code></pre> You tell the agent to use default values for create_background, the same as in create_screen. It changes the code to:<p><pre><code> # Now create_background params have default values, the same as create_screen in screen.py def create_background(width: int = DEFAULT_WIDTH, height: int = DEFAULT_HEIGHT) -&gt; Image: ... </code></pre> The unnecessary comment is a staple of vibed code, but the tone also annoys me because it leaves behind the prompt. It words comments based on what it was asked to do, not in a timeless manner.<p>I keep telling people in code reviews to remove unnecessary comments, and I feel I lack the vocabulary to express why this is bad.