first transform, then visit, to not get incorrect line markers
还没有人认领这个 Issue。
评估
调研方向
从失败的测试 test_line_numbers_match_end_result 开始,跟踪 Plugin.from_source、initialize_options 和 plugin.run。检查 autofixer 和 visitor 的执行顺序,以及行标记是如何保留的。完成的标准是:autofixer 在重新解析之前运行,visitor 能看到转换后的源代码,并且 assertion 报告 trio.sleep(0) 所在的正确行号。
由索引模型根据 Issue 内容生成。
描述
low-priority QoL - unless flake8-trio is used in automated environments.
Failing test:
def test_line_numbers_match_end_result():
text = """import trio
with trio.move_on_after(10):
...
trio.sleep(0)
"""
plugin = Plugin.from_source(text)
initialize_options(plugin, args=["--enable=TRIO100,TRIO115", "--autofix=TRIO100"])
errors = tuple(plugin.run())
new_source = plugin.module.code
assert errors[1].line == plugin.module.code.split('\n').index('trio.sleep(0)')+1
the assertion fails with 5 != 4 as the line numbers of objects are never updated once parsed when initiating the plugin.
The best way to fix this would probably, as the header suggest, be to first make a pass where all enabled autofixers are run - with autofixed errors being printed out with old and/or no line markers. Then the file is reparsed, and enabled visitors are run on the file.
- 主要语言
- Python
- 星标
- 26
- 派生
- 11
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-trio/flake8-async 的其他 Issue
-
rule improvement
难度 2/5 1-3 小时 新手友好度 68/100
python-trio/flake8-async#457 · 1 个 reaction ·
-
Extend ASYNC401 to other forms可能已有人在做 @anshurajbisoyi98-ctrl 于 7 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
python-trio/flake8-async#475 · 1 条评论 · 1 个 reaction ·
-
new rule
难度 3/5 1-2 天 新手友好度 55/100
python-trio/flake8-async#454 · 1 条评论 ·
-
rule improvement
难度 3/5 1-2 天 新手友好度 62/100
python-trio/flake8-async#447 · 5 条评论 ·
-
New rule: `ASYNC233` for blocking `pathlib` methods可能已有人在做 @paranoa233 于 95 天前认领。 未关闭good first issue
难度 5/5 一周以上 新手友好度 15/100
python-trio/flake8-async#396 · 1 条评论 ·
查看 python-trio/flake8-async 的全部 Issue
相似的 Issue
-
dependencies feature github_actions good first issue
难度 2/5 1-3 小时 新手友好度 62/100
wemake-services/wemake-django-template#3149 ·
维护者通常 1 天内回复
-
upstream update
难度 2/5 1-3 小时 新手友好度 65/100
conan-io/conan-center-index#31142 ·
维护者通常 1 天内回复
-
area:core bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
request-theme
难度 2/5 1 小时以内 新手友好度 70/100
LizardByte/ThemerrDB#8877 · 1 条评论 ·
维护者通常 1 天内回复
-
area/install-update comp/gateway P0 sweeper:risk-compatibility type/bug
难度 2/5 1 小时以内 新手友好度 72/100
NousResearch/hermes-agent#135997 · 3 条评论 ·
维护者通常 1 天内回复