E303: too many blank lines (2)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia individuando il controllo E303 e verificando come viene attualmente testato il suo limite di righe vuote. Confronta le opzioni proposte per il conteggio delle eccezioni e per il limite configurabile con il testo di PEP 8, quindi chiarisci la policy prevista con i maintainer prima di implementare qualsiasi cosa. Il lavoro è concluso quando sono stati definiti il comportamento e i test che coprono i casi accettati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
quoting PEP 8 :
"Surround top-level function and class definitions with two blank lines.
Method definitions inside a class are surrounded by a single blank line.
Extra blank lines may be used (sparingly) to separate groups of related functions. Blank lines may be omitted between a bunch of related one-liners (e.g. a set of dummy implementations)."
Which may be usefull, for example, if you are used to split your function in really small unit accordingly to the SRP (and Clean Code book of Robert C. Martin).
For example if you have a snippet like this one, with a lot more of subfunction :
class foo():
def usefull_function(self):
_sub_function_a()
_sub_function_b()
def _sub_function_a(self):
#do_stuff
def _sub_function_b(self):
#do_stuff
def other_function_with_subfunction(self): # Two blank lines before this might be cleaner.
_sub_function_c()
_sub_function_d()
def _sub_function_c(self):
#do_stuff
def _sub_function_d(self):
#do_stuff
This snippet is here to give an example of why this can be used, but anyway, the PEP states it's ok.
Question :
- Should pycodestyle allow more blank lines that the recommandation (and not restriction)?
Options that could be implemented
- Selecting the number of exception to the recommandation that can be applied to a class (enhance the "sparingly" in the PEP8 quotation)
- Selecting the max number of extra blank line before class, top-level function and method.
Pros :
- Real check of the PEP8.
- Let you more option for clean code.
Cons :
- In the main use case, you want only one blank line before a def, and it will allow some wrong blank space to sneak in the code.
- Lingua principale
- Python
- Stelle
- 5.2k
- Fork
- 756
- Merge medio
- 16h 56m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PyCQA/pycodestyle
-
DOC: E252 is not documentedAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
PyCQA/pycodestyle#1294 · 1 commento ·
-
Typing and formattingAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
PyCQA/pycodestyle#1302 · 3 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
PyCQA/pycodestyle#1242 · 2 commenti ·
-
Spurious E231 for nested format substitutionsForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
PyCQA/pycodestyle#1241 · 2 commenti · 4 reazioni ·
-
`exclude` is applied to `.`Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
PyCQA/pycodestyle#1217 ·
Tutte le issue di PyCQA/pycodestyle
Issue simili
-
feature:LinkChecker
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
digitalfabrik/integreat-cms#4594 ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
EleutherAI/lm-evaluation-harness#4319 ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
json_params_matcher fails on falsy top-level JSON primitives (0, False, "")Forse già presa @mayureshsonawane17 l’ha presa oggi. ApertaWaiting for: Product Owner
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 5 giorni