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

Duplicate autogen.sh entry in commoncode default ignores

未关闭 适合新手
#5,316 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

@Daksha1611 已经在做这个了。

开始于 2026年9月11日。

  • #5317 来自 @Daksha1611 —— 未关闭

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
92/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
tooling

调研方向

检查 src/commoncode/ignore.py,找到第 204-205 行附近的 default ignores dict,其中 "autogen.sh" 出现了两次。从这里开始,删除一个重复条目,使每个键只列出一次。使用提供的命令 grep -n '\"autogen.sh\"' src/commoncode/ignore.py 或报告中的 AST 重复键代码片段进行验证;当重复行已被删除且没有报告重复键时,即表示完成。

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

描述

Description

src/commoncode/ignore.py lists the same key twice in the default ignores, on two byte-identical consecutive lines (204-205):

    "autogen.sh": "Default ignore: autotools artifact",
    "autogen.sh": "Default ignore: autotools artifact",

Nothing misbehaves here — the key and the value are identical, so the dict ends up the same either way. It is just a dead line, and filing it as a small cleanup rather than a bug.

How To Reproduce
$ grep -n '"autogen.sh"' src/commoncode/ignore.py
204:    "autogen.sh": "Default ignore: autotools artifact",
205:    "autogen.sh": "Default ignore: autotools artifact",
import ast, collections

src = open('src/commoncode/ignore.py').read()
for node in ast.walk(ast.parse(src)):
    if isinstance(node, ast.Dict):
        counts = collections.Counter(
            k.value for k in node.keys
            if isinstance(k, ast.Constant) and isinstance(k.value, str)
        )
        for key, n in counts.items():
            if n > 1:
                print(f'line {node.lineno}: duplicate key {key!r} x{n}')
line 185: duplicate key 'autogen.sh' x2
Suggested fix

Delete one of the two lines. PR attached.

System configuration
  • What OS are you running on? Linux (x86_64)
  • What version of scancode-toolkit was used? 33.0.0rc1, develop at 5ebebf2
  • What installation method was used to install/run scancode? source checkout
  • Python version: 3.x
主要语言
Python
星标
2.7k
派生
831
平均合并
3 天 4 小时
30 天内合并 PR
7

环境准备

从这里开始

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

aboutcode-org/scancode-toolkit 的其他 Issue

查看 aboutcode-org/scancode-toolkit 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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