From 5e1ca2a43724f3d3737c6388656d17caa815a8e2 Mon Sep 17 00:00:00 2001 From: Sharpz7 Date: Mon, 15 Jan 2024 07:16:35 +0000 Subject: [PATCH] [codespell] Add tox target and configuration for codespell Continuing the work of @JayF in other repos. Adds a tox target for codespell, `tox -e codespell`. Can optionally be run as `tox -e codespell -- -w` to get automatic spelling fixes applied where appropriate. Adds small amounts of configuration to setup.cfg, including an ignore list of words. Related Bug: https://bugs.launchpad.net/ironic-python-agent/+bug/2047654 Change-Id: I284045ee9dfb51eee59a0442abda657c74abed05 --- setup.cfg | 6 ++++++ tox.ini | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/setup.cfg b/setup.cfg index eec06428..81fd5439 100644 --- a/setup.cfg +++ b/setup.cfg @@ -47,3 +47,9 @@ json_rpc = keystoneauth1>=4.2.0 # Apache-2.0 os-service-types>=1.2.0 # Apache-2.0 oslo.service!=1.28.1,>=1.24.0 # Apache-2.0 + +[codespell] +quiet-level = 4 +# Words to ignore: +# crypted: Valid in some contexts, e.g. "crypted password" +ignore-words-list = crypted \ No newline at end of file diff --git a/tox.ini b/tox.ini index 40f26323..10b5b03c 100644 --- a/tox.ini +++ b/tox.ini @@ -73,3 +73,12 @@ allowlist_externals = make commands = sphinx-build -b latex doc/source doc/build/pdf make -C doc/build/pdf + +[testenv:codespell] +description = + Run codespell to check spelling +deps = codespell +# note(adamcarthur): {posargs} lets us run `tox -ecodespell -- -w` to get codespell +# to correct spelling issues in our code it's aware of. +commands = + codespell {posargs} \ No newline at end of file