bug/feature_request(urls): false positives for URLs
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
[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
- This expression doesn’t match correctly examples of Mathias Bynens, but is sufficient for practical Codespell usage in my case.
- 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:
\s— for the Python regular expression syntax\smetacharacter “includes[ \t\n\r\f\v]and also many other characters, for example the non-breaking spaces mandated by typography rules in many languages”.- Another forbidden ASCII characters in URLs.
4. Environment
-
Operating system:
- Local — Microsoft Windows [Version 10.0.22621.3085]
- Travis CI — Ubuntu 24.04.2 LTS Noble Numbat
- AppVeyor CI — Microsoft Windows [Version 10.0.17763.6189]
-
Python:
- Local — 3.13.2
- Travis CI — 3.13.1
- AppVeyor CI — 3.12.8
-
Codespell 2.4.1
Thanks.
- 主要语言
- Python
- 星标
- 2.4k
- 派生
- 531
- 平均合并
- 15 小时 5 分钟
- 30 天内合并 PR
- 18
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codespell-project/codespell 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
codespell-project/codespell#3997 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 63/100
codespell-project/codespell#3965 · 3 条评论 ·
维护者通常 1 天内回复
-
Add "marcos"可能已有人在做 @ekanshul 于 20 天前认领。 未关闭dictionary
难度 2/5 1-3 小时 新手友好度 72/100
codespell-project/codespell#3920 · 3 条评论 ·
维护者通常 1 天内回复
-
question
难度 3/5 1-2 天 新手友好度 55/100
codespell-project/codespell#4005 ·
维护者通常 1 天内回复
-
duplicate question
难度 2/5 1-3 小时 新手友好度 35/100
codespell-project/codespell#3998 ·
维护者通常 1 天内回复
查看 codespell-project/codespell 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
Graphify-Labs/graphify#4860 · 1 条评论 ·
维护者通常 1 天内回复
-
:bug: Bug
难度 2/5 1-3 小时 新手友好度 84/100
scikit-image/scikit-image#8377 ·
维护者通常 1 天内回复
-
Ingredient import validation accepts negative nutrient values and NaN可能已有人在做 @LukeSekai 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
wger-project/wger#2564 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
apache/ponymail-foal#351 ·
-
难度 1/5 1 小时以内 新手友好度 68/100
维护者通常 4 天内回复