Add built-in validation checks for directive syntax

Abierto
#507 1 comentario 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Revisa las comprobaciones de validación integradas existentes vinculadas en el issue y compara su comportamiento con los ejemplos de directivas no válidas y corregidas. Añade validación para un bloque de contenido de directiva sin sangría, asegurándote de que se informe el diagnóstico propuesto mientras que la sintaxis con la sangría correcta pase.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Issue/bug

Currently, the following invalid directive syntax is not checked by numpydoc-validation

.. directive::
Some text

The numpydoc-validation checks will pass, but the invalid syntax will result in a documentation build failure with a warning and/or error such as:

WARNING: Explicit markup ends without a blank line; unexpected unindent.
ERROR: Content block expected for the "note" directive; none found.

The correct syntax, according to the reST documentation, is:

+-------+-------------------------------+
| ".. " | directive type "::" directive |
+-------+ block                         |
        |                               |
        +-------------------------------+

Therefore, in the first example provided above, the errors/warnings are resolved by indenting the block of text, i.e.:

.. directive::
    Some text

Here is an example build failure and the subsequent commit diff with added indentation which resolved the warnings and errors and resulted in a successful documentation build. Ideally, this invalid syntax would have been caught by a pre-commit hook such as numpydoc-validation so that it could be addressed before running CI testing to avoid the inevitable documentation build failure.

This appears to be a somewhat common problem, e.g. reported here and here.

Feature request

The feature request is to add additional validation check(s) for the correct syntax of directives, e.g. add a new mapping to the existing checks, something like:

  • "GL11": "reST directives {directives} text block must be indented."

Thank you for your time.

Lenguaje dominante
Python
Estrellas
354
Forks
185
Merge medio
4 min
PR fusionados (30 d)
1

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de numpy/numpydoc

Todos los issues de numpy/numpydoc

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.