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

Aperta Adatta ai principianti
#706 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, typescript
Ambito
cli, testing-qa

Direzione di ricerca

Inizia da src/core-open/scanners/python-scanner.ts e leggi parsePyprojectToml, appendPoetryDependencyTable e l’helper esistente collectQuotedStrings per vedere come lo scanner gestisce entrambi gli stili di virgolette. Aggiungi casi di regressione accanto ai test di Python runtime e Poetry, includendo virgolette miste ed entrambe le forme Poetry. Il lavoro è terminato quando i casi di accettazione passano e il comportamento esistente con le virgolette doppie rimane invariato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
4
Fork
3
Merge medio
1g 22h
PR unite (30g)
76

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vibgrate/cli

Tutte le issue di vibgrate/cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.