From 6f8ad70e254c6d4cc20e37813e26791f286fad9e Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Mon, 21 Nov 2022 21:14:49 +0000 Subject: [PATCH] Add sphinx-lint and awk-based line length detector to make verifs. (#6) Reviewed-on: https://git.afpy.org/AFPy/python-docs-fr/pulls/6 Co-authored-by: Julien Palard Co-committed-by: Julien Palard --- Makefile | 14 ++++++++++++-- glossary.po | 3 ++- requirements.txt | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 7e3521e2..c9d6ca5e 100644 --- a/Makefile +++ b/Makefile @@ -137,9 +137,19 @@ DESTS = $(addprefix $(POSPELL_TMP_DIR)/,$(addsuffix .out,$(SRCS))) .PHONY: spell spell: ensure_prerequisites $(DESTS) +.PHONY: line-length +line-length: + @echo "Searching for long lines..." + @awk '{if (length(gensub(/శ్రీనివాస్/, ".", "g", $$0)) > 80 && length(gensub(/[^ ]/, "", "g")) > 1) {print FILENAME ":" FNR, "line too long:", $$0; ERRORS+=1}} END {if (ERRORS>0) {exit 1}}' *.po */*.po + +.PHONY: sphinx-lint +sphinx-lint: + @echo "Checking all files using sphinx-lint..." + @sphinx-lint --enable all --disable line-too-long *.po */*.po + $(POSPELL_TMP_DIR)/%.po.out: %.po dict @echo "Pospell checking $<..." - mkdir -p $(@D) + @mkdir -p $(@D) pospell -p dict -l fr_FR $< && touch $@ .PHONY: fuzzy @@ -147,7 +157,7 @@ fuzzy: ensure_prerequisites potodo -f --exclude venv .venv $(EXCLUDED) .PHONY: verifs -verifs: spell +verifs: spell line-length sphinx-lint .PHONY: clean clean: diff --git a/glossary.po b/glossary.po index a3642f6c..74115c73 100644 --- a/glossary.po +++ b/glossary.po @@ -262,7 +262,8 @@ msgstr "itérateur de générateur asynchrone" #: glossary.rst:113 msgid "An object created by a :term:`asynchronous generator` function." -msgstr "Objet créé par un :term:`générateur asynchrone `." +msgstr "" +"Objet créé par un :term:`générateur asynchrone `." #: glossary.rst:115 msgid "" diff --git a/requirements.txt b/requirements.txt index 9e489c6e..e634cbc8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ poutils==0.13.0 +sphinx-lint