From 10389bc6d9c7b7a7e6b914d67ba1a52e9eb6b1b3 Mon Sep 17 00:00:00 2001 From: Nathan Weinberg Date: Mon, 3 Jun 2024 13:48:15 -0400 Subject: [PATCH] Add local Spellcheck and sorting Signed-off-by: Nathan Weinberg --- .gitignore | 1 + .spellcheck-en-custom.txt | 5 +++++ .spellcheck.yml | 28 ++++++++++++++++++++++++++++ Makefile | 8 ++++++++ 4 files changed, 42 insertions(+) create mode 100644 .spellcheck-en-custom.txt create mode 100644 .spellcheck.yml diff --git a/.gitignore b/.gitignore index 7e340beb..4263ad7f 100644 --- a/.gitignore +++ b/.gitignore @@ -132,6 +132,7 @@ venv/ ENV/ env.bak/ venv.bak/ +dictionary.dic # Spyder project settings .spyderproject diff --git a/.spellcheck-en-custom.txt b/.spellcheck-en-custom.txt new file mode 100644 index 00000000..0cc4115d --- /dev/null +++ b/.spellcheck-en-custom.txt @@ -0,0 +1,5 @@ +# make spellcheck-sort +# Please keep this file sorted: +# SPDX-License-Identifier: Apache-2.0 +sdg +Tatsu diff --git a/.spellcheck.yml b/.spellcheck.yml new file mode 100644 index 00000000..36dc7e40 --- /dev/null +++ b/.spellcheck.yml @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: Apache-2.0 + +matrix: +- name: markdown + aspell: + lang: en + d: en_US + camel-case: true + mode: markdown + sources: + - "**/*.md|!.tox/**|!venv/**" + dictionary: + wordlists: + - .spellcheck-en-custom.txt + pipeline: + - pyspelling.filters.context: + context_visible_first: true + escapes: '\\[\\`~]' + delimiters: + # Ignore multiline content between fences (fences can have 3 or more back ticks) + # ```language + # content + # ``` + - open: '(?s)^(?P *`{3,}).*?$' + close: '^(?P=open)$' + # Ignore text between inline back ticks + - open: '(?P`+)' + close: '(?P=open)' diff --git a/Makefile b/Makefile index 8b032f30..da755986 100644 --- a/Makefile +++ b/Makefile @@ -31,3 +31,11 @@ check: ## check git diff between this repo and the CLI generator directory md-lint: ## Lint markdown files $(ECHO_PREFIX) printf " %-12s ./...\n" "[MD LINT]" $(CMD_PREFIX) podman run --rm -v $(CURDIR):/workdir --security-opt label=disable docker.io/davidanson/markdownlint-cli2:latest > /dev/null + +.PHONY: spellcheck +spellcheck: ## Spellcheck markdown files + $(CMD_PREFIX) python -m pyspelling --config .spellcheck.yml --spellchecker aspell + +.PHONY: spellcheck-sort +spellcheck-sort: .spellcheck-en-custom.txt ## Sort spellcheck directory + sort -d -f -o $< $<