Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

project-create generates an invalid class name when the project name starts with a digit

Aperta
#673 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@Amadeus-22 ci sta già lavorando.

Dal 6/10/2026.

  • #674 di @Amadeus-22 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
40/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Find the code handling the project-create command in the lean-cli codebase, likely in a commands or templates directory. Look for the function that generates class names by removing non-alphanumeric characters from the project name. Add a check to prefix the result with an underscore when it starts with a digit or is empty, then add tests for project names like '2024 Momentum' and '123'.

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

Descrizione

Expected Behavior

lean project-create writes a main file that compiles, whatever the project name is.

Actual Behavior

The class name is the project name with non-alphanumeric characters removed. If the name starts with a digit, the generated class is not a valid identifier in Python or C#:

$ lean project-create --language python "2024 Momentum"
$ grep class "2024 Momentum/main.py"
class 2024Momentum(QCAlgorithm):

python -m py_compile on that file fails with SyntaxError: invalid decimal literal. A name with only digits (123) gives class 123(QCAlgorithm):. The command exits with code 0 in both cases, so the problem only shows up when the project is run.

Potential Solution

Prefix the class name with an underscore when it is empty or starts with a digit (_2024Momentum). I can open a PR with the fix and tests.

Reproducing the Problem

See the commands above.

System Information

lean-cli master at 20e58aa, Linux.

Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
Lingua principale
Python
Stelle
327
Fork
170
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 QuantConnect/lean-cli

Tutte le issue di QuantConnect/lean-cli

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.