Bug: single-quoted strings in `pyproject.toml` are ignored

未关闭 适合新手
#706 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python, typescript
领域
cli, testing-qa

调研方向

从 src/core-open/scanners/python-scanner.ts 开始,阅读 parsePyprojectToml、appendPoetryDependencyTable 和现有的 collectQuotedStrings helper,了解扫描器如何处理两种引号风格。在 Python runtime 和 Poetry 测试旁添加回归用例,包括混合引号和两种 Poetry 形式。验收用例通过且现有的双引号行为保持不变时,即为完成。

由索引模型根据 Issue 内容生成。

描述

bug good first issue
  • Difficulty: small (a few hours)
  • Area: Python scanner
Problem

parsePyprojectToml in src/core-open/scanners/python-scanner.ts only accepts double-quoted TOML strings for the project name, requires-python, and [project] dependencies:

# around lines 1032–1040
const nameMatch = content.match(/^\s*name\s*=\s*"([^"]+)"/m);
const pyVerMatch = content.match(/^\s*requires-python\s*=\s*"([^"]+)"/m);
# dependencies array: const lineRegex = /"([^"]+)"/g;

Poetry tables have the same limit (appendPoetryDependencyTable, around line 989): name = "version" and { version = "..." } match only "...".

Single quotes are valid TOML. A project written like this reports no runtime and no dependencies:

[project]
name = 'demo'
requires-python = '>=3.11'
dependencies = [
    'requests>=2.31',
    "flask>=3.0",
]

[project.optional-dependencies] and [dependency-groups] already go through collectQuotedStrings, which accepts both quote styles. Pipfile [requires] was fixed the same way. The [project] block and Poetry tables were not.

Expected behaviour

Single-quoted, double-quoted, and triple-quoted strings are read the same way in [project] and in Poetry dependency tables. A mixed array ('requests>=2.31' next to "flask>=3.0") keeps both packages. Existing double-quoted fixtures stay unchanged.

Acceptance
  • Add tests next to the existing Python / Poetry cases (for example test/python-runtime-pin.test.ts and the Poetry / optional-deps tests).
  • requires-python = '>=3.11' reports Python 3.11 as the runtime.
  • A [project] dependencies array of only single-quoted requirement strings exports those packages from vg scan.
  • A mixed-quote array keeps every entry.
  • Poetry requests = '2.31.0' and requests = { version = '2.31.0' } are read.
  • Double-quoted forms, and a project with no requires-python, behave as they do today.

主要语言
TypeScript
星标
4
派生
3
平均合并
1 天 22 小时
30 天内合并 PR
76

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vibgrate/cli 的其他 Issue

查看 vibgrate/cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。