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

first transform, then visit, to not get incorrect line markers

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

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
tooling

Direzione di ricerca

Inizia dal test fallito test_line_numbers_match_end_result e segui Plugin.from_source, initialize_options e plugin.run. Verifica in quale sequenza vengono eseguiti gli autofixer e i visitor e come vengono mantenuti i marcatori di riga. Il lavoro è completato quando gli autofixer vengono eseguiti prima del nuovo parsing, i visitor vedono il codice sorgente trasformato e l’assertion segnala la riga corretta per trio.sleep(0).

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

Descrizione

bug

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.

Lingua principale
Python
Stelle
26
Fork
10
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

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 python-trio/flake8-async

Tutte le issue di python-trio/flake8-async

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.