aboutcode-org / aboutcode-org/scancode-toolkit

Treat 'comments' and 'actual code' differently while scanning a file.

Đang mở
#1,995 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
new feature
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ả

## Short Description

Examine the following code sample:

```python
def main():
for i in range(20):
print("cc", "by", "nd")

gpl = 20
print(gpl*80)
```
although, they don't really signify those licences, but scancode outputs following:
- cc-by-4.0
- GPL 2.0
- GPL 1.0 or later

It would be better if scancode separates comments/docstrings and actual code in a file before scanning *since the the licence or stuff like that are almost always found in comments/docstrings.*

For this we need to accurately detect programming language (pygments doesn't) and scan accordingly since now we know what character(s) (for that programming language) is used to add comment/docstring.

*Also, this would result in faster scans.*

Similar issues:
https://github.com/nexB/scancode-toolkit/issues/1933

## Possible Labels

- new feature

## Select Category

- Enhancement [x]
- Add License/Copyright []
- Scan Feature [x]
- Packaging []
- Documentation []
- Expand Support []
- Other []

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.