aboutcode-org / aboutcode-org/scancode-toolkit

Duplicate autogen.sh entry in commoncode default ignores

Đang mở
#5,316 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
2.6k
Fork
791
Merge trung bình
1 ngày 12 giờ
Pull request đã merge (30 ngày)
5

Mô tả

### Description

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

```python
"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",
```

```python
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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.