Skip to content

Introduce sphinx-lint #2234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Declara dependencia en sphinx-lint 0.6.7
Ya que de versión a versión nuevos chequeos pueden ser agregados,
preferí hacer un pin de la versión y así asegurar la estabilidad de las
corridas. Un dependabot podría luego chequear si hay versiones nuevas y
mostrarnos si acaso hay errores nuevos en el linteo o no.
  • Loading branch information
rtobar committed Nov 28, 2022
commit ec94dddb0a07a654328e58d2473ca8dbabb9fddb
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
diff -Naur TRANSLATORS <(LANG=es python scripts/sort.py < TRANSLATORS)
- name: Powrap
run: powrap --check --quiet **/*.po
- name: Sphinx lint
run: |
sphinx-lint */*.po
- name: Pospell
run: |
python scripts/check_spell.py
Expand Down
37 changes: 37 additions & 0 deletions .overrides/reviewers-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,43 @@ Tres razones por las que puede fallar el *build* de Travis:

Para facilitar la comparación de ficheros se emplea este programa que va a hacer que todas las líneas tengan el mismo tamaño. Solucionar este problema en nuestra traducción es muy sencillo, solo hay que instalar la herramienta powrap en nuestro entorno y ejecutar el comando ``powrap nuestro_fichero.po``

``sphinx-lint`` falla
---------------------

El formato en el que la documentación de python está escrito
(`reStructredText <https://es.wikipedia.org/wiki/ReStructuredText>`_ , o rst)
puede ser difícil de manejar y escribir correctamente.
``sphinx-lint`` ayuda a encontrar errores comunes al momento de escribir
entradas en este formato, y advierte al respecto.

Entre los errores más comunes están:

* Textos literales no están separados por un espacio
respecto a las palabras que lo rodean:

* Mal: :literal:`no hay espacio antes del\`\`literal\`\``
* Mal: :literal:`después del \`\`literal \`\`no hay un espacio`
* Bien: :literal:`hay espacio antes del \`\`literal\`\` y después también`

* Textos literales comienzan o terminan con espacios:

* Mal: :literal:`\`\` literal empieza con un espacio\`\``
* Mal: :literal:`\`\`literal termina con un espacio \`\``
* Bien: :literal:`\`\`literal no termina ni empieza con espacios\`\``

* Textos literales no están delineados con dos acentos fuertes:

* Mal: :literal:`\`\`falta uno al final :(\``
* Mal: :literal:`\`falta uno al principio :(\`\``
* Bien: :literal:`\`\`todo bien :)\`\``

* Enlaces no terminan en un guión bajo:

* Mal: :literal:`\`<https://python.org>\``
* Mal: :literal:`\`Python <https://python.org>\``
* Bien: :literal:`\`<https://python.org>\`_`
* Bien: :literal:`\`Python <https://python.org>\`_`


``pospell`` falla
---------------------
Expand Down
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ repos:
language: python
additional_dependencies: ['pospell>=1.1']
files: \.po$
- id: lint
name: Run sphinx linting
entry: sphinx-lint
language: python
additional_dependencies: ['sphinx-lint==0.6.7']
files: \.po$
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ progress: venv
spell: venv
$(VENV)/bin/python scripts/check_spell.py

.PHONY: lint
lint: venv
$(VENV)/bin/python -m sphinxlint */*.po


.PHONY: wrap
wrap: venv
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ pre-commit
sphinx-autorun
sphinxemoji
sphinx-tabs
sphinx-lint==0.6.7
tabulate