Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

bug/feature_request(urls): false positives for URLs

Đang mở
#3,677 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli, tooling

Hướng nghiên cứu

Start by reproducing the reported false positives with codespell KiraURLs.txt and compare that output with the ignore-regex and uri-regex settings in codespell.cfg. The report does not name implementation files or tests; done means the intended URL handling is clear and the supplied URL examples no longer produce unwanted spellcheck results.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

question

Related issues — #676, #2473, #3211.

1. Summary

When I run Codespell for my project, I get 14 false positives for URLs. I’m sure that default Codespell behavior for URLs need corrections.

2. MCVE
2.1. Reproducibility

I reproduced the problem on Ubuntu and Windows.

  1. Ubuntu build on Travis CI
  2. Windows build on AppVeyor CI

[NOTE] I get different behavior for Ubuntu and Windows. By default, for Ubuntu Codespell prints to console a colored output, for Windows — non-colored.

2.2. Files

KiraURLs.txt — the file with false positives from my real project:

https://browsersl.ist/
https://archive.fo/JaBJt
https://magisteria.ru/autor/andrey_vinogradov
https://woerterbuchnetz.de/?sigle=DWB&lemid=U14452
https://www.pucp.edu.pe/profesor/patricia-gonzales-gil
https://zoon.ru/msk/p-doctor/marina_vladimirovna_kuznetsova/
https://persona.rin.ru/view/f/0/25814/kolesov-evgenij-nikolaevich
https://broker.ru/studing/seminar/303
https://www.wirtschaftsdienst.eu/autor/walter-a-s-koch.html
https://web.archive.org/web/20160306044838/https://xpomo.com/ruskolan/tolpa/demagog.htm
https://base.garant.ru/10180093/
https://web.archive.org/web/20210509023444/https://portal.slac.stanford.edu/sites/inc_public/Pages/folder-file-names.aspx
https://portal.slac.stanford.edu/sites/inc_public/Pages/folder-file-names.aspx
https://www.digitalo.cz/dokument/qBhi6rSjJ87tFJ6y/plny-text.pdf#page=102

codespell.cfg:

[codespell]

ignore-regex = https?://[^\s`"<>^\\{|}]+

[NOTE] The uri-regex key with the same value has no effect. It’s a possible bug.

2.3. Commands
codespell --config codespell.cfg KiraURLs.txt
codespell KiraURLs.txt
2.4. Behavior
2.4.1. Expected — my regex

No output. Codespell ignores all URLs.

2.4.2. Non-desired — default Codespell behavior
codespell KiraURLs.txt
KiraURLs.txt:1: ist ==> is, it, its, it's, sit, list
KiraURLs.txt:2: fo ==> of, for, to, do, go
KiraURLs.txt:3: autor ==> author
KiraURLs.txt:4: sigle ==> single, sigil
KiraURLs.txt:5: profesor ==> professor
KiraURLs.txt:6: zoon ==> zoom
KiraURLs.txt:7: rin ==> ring, rink, rind, rain, rein, ruin, grin
KiraURLs.txt:8: studing ==> studying
KiraURLs.txt:9: autor ==> author
KiraURLs.txt:10: demagog ==> demagogue
KiraURLs.txt:11: garant ==> guarantor, guardant
KiraURLs.txt:12: slac ==> slack
KiraURLs.txt:13: slac ==> slack
KiraURLs.txt:14: dokument ==> document
Command exited with code 65

False positives for each line.

3. Regular expression for URLs

For my project I use this regular expression for URLs:

https?://[^\s`"<>^\\{|}]+

Perhaps it will help another users.

3.1. Advantages of my regex
  1. This expression doesn’t match correctly examples of Mathias Bynens, but is sufficient for practical Codespell usage in my case.
  2. It’s simple and shouldn’t slow down Codespell too much.
3.2. Explanation of my regex

It allowed any Unicode symbols in URLs except:

  1. \s — for the Python regular expression syntax \s metacharacter “includes [ \t\n\r\f\v] and also many other characters, for example the non-breaking spaces mandated by typography rules in many languages”.
  2. Another forbidden ASCII characters in URLs.
4. Environment
  1. Operating system:

    1. Local — Microsoft Windows [Version 10.0.22621.3085]
    2. Travis CI — Ubuntu 24.04.2 LTS Noble Numbat
    3. AppVeyor CI — Microsoft Windows [Version 10.0.17763.6189]
  2. Python:

    1. Local — 3.13.2
    2. Travis CI — 3.13.1
    3. AppVeyor CI — 3.12.8
  3. Codespell 2.4.1

Thanks.

Ngôn ngữ chính
Python
Star
2.4k
Fork
531
Merge trung bình
15 giờ 5 phút
Pull request đã merge (30 ngày)
18

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của codespell-project/codespell

Tất cả issue của codespell-project/codespell

Issue tương tự

Thêm issue về Python

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.