E303: too many blank lines (2)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
Empieza por localizar la comprobación E303 y revisar cómo se prueba actualmente su límite de líneas en blanco. Compara las opciones propuestas de recuento de excepciones y de límite configurable con el texto de PEP 8 y, después, aclara la política prevista con los mantenedores antes de implementar nada. Se considera terminado cuando haya un comportamiento decidido y pruebas que cubran los casos aceptados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 5.2k
- Forks
- 754
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PyCQA/pycodestyle
-
DOC: E252 is not documentedAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
PyCQA/pycodestyle#1294 · 1 comentario ·
-
Typing and formattingAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
PyCQA/pycodestyle#1302 · 3 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
PyCQA/pycodestyle#1242 · 2 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
PyCQA/pycodestyle#1241 · 2 comentarios · 4 reacciones ·
-
`exclude` is applied to `.`Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
PyCQA/pycodestyle#1217 ·
Todos los issues de PyCQA/pycodestyle
Issues similares
-
bug server
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
sportsdataverse/sportsdataverse-py#641 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
googleapis/google-cloud-python#18532 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día