From cd2b6a9d6857f3f9815c3ded29ad153fec74c816 Mon Sep 17 00:00:00 2001 From: Gal Bashan Date: Thu, 18 Aug 2022 00:26:28 +0300 Subject: [PATCH] Adding Codespell to the CI (#2878) --- .codespellrc | 4 ++++ .github/workflows/test.yml | 2 +- CONTRIBUTING.md | 1 + dev-requirements.txt | 1 + tox.ini | 10 ++++++++++ 5 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .codespellrc diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000000..06101c9f484 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,4 @@ +[codespell] +# skipping auto generated folders +skip = ./.tox,./.mypy_cache,./docs/_build,./target +ignore-words-list = ans,ue,ot,hist diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6068e43d5c2..5d7277e910c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -92,7 +92,7 @@ jobs: strategy: fail-fast: false matrix: - tox-environment: [ "docker-tests", "lint", "docs", "mypy", "mypyinstalled", "tracecontext" ] + tox-environment: [ "docker-tests", "lint", "spellcheck", "docs", "mypy", "mypyinstalled", "tracecontext" ] name: ${{ matrix.tox-environment }} runs-on: ubuntu-20.04 steps: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 283ad008fe6..7ef351b38cb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,6 +61,7 @@ You can run `tox` with the following arguments: - `tox -e opentelemetry-api` and `tox -e opentelemetry-sdk` to run the API and SDK unit tests - `tox -e py37-opentelemetry-api` to e.g. run the API unit tests under a specific Python version +- `tox -e spellcheck` to run a spellcheck on all the code - `tox -e lint` to run lint checks on all code `black` and `isort` are executed when `tox -e lint` is run. The reported errors can be tedious to fix manually. diff --git a/dev-requirements.txt b/dev-requirements.txt index 77caf0ff2ed..3af6328fad7 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -18,3 +18,4 @@ protobuf~=3.18.1 # breaking change introduced in markupsafe causes jinja, flask to break markupsafe==2.0.1 bleach==4.1.0 # This dependency was updated to a breaking version. +codespell==2.1.0 diff --git a/tox.ini b/tox.ini index 73df1f69285..ec7bb09bda1 100644 --- a/tox.ini +++ b/tox.ini @@ -62,6 +62,7 @@ envlist = pypy3-opentelemetry-propagator-jaeger lint + spellcheck tracecontext mypy,mypyinstalled docs @@ -180,6 +181,15 @@ commands = ; implicit Any due to unfollowed import would result). mypyinstalled: mypy --install-types --non-interactive --namespace-packages opentelemetry-api/tests/mypysmoke.py --strict +[testenv:spellcheck] +basepython: python3.9 +recreate = True +deps = + codespell + +commands = + codespell + [testenv:lint] basepython: python3.9 recreate = True