From 640fab7a9c3dc577c6c49857b8f5e1d92fc30c6c Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 29 Dec 2022 23:47:26 +0100 Subject: [PATCH 1/5] Add codespell dependency --- changes/15.internal.md | 1 + poetry.lock | 19 ++++++++++++++++++- pyproject.toml | 5 +++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 changes/15.internal.md diff --git a/changes/15.internal.md b/changes/15.internal.md new file mode 100644 index 00000000..752ca9a3 --- /dev/null +++ b/changes/15.internal.md @@ -0,0 +1 @@ +Add codespell tool, to automatically find spelling mistakes. diff --git a/poetry.lock b/poetry.lock index 06dcba94..cb51b2a4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -180,6 +180,23 @@ files = [ [package.dependencies] click = "*" +[[package]] +name = "codespell" +version = "2.2.2" +description = "Codespell" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "codespell-2.2.2-py3-none-any.whl", hash = "sha256:87dfcd9bdc9b3cb8b067b37f0af22044d7a84e28174adfc8eaa203056b7f9ecc"}, + {file = "codespell-2.2.2.tar.gz", hash = "sha256:c4d00c02b5a2a55661f00d5b4b3b5a710fa803ced9a9d7e45438268b099c319c"}, +] + +[package.extras] +dev = ["check-manifest", "flake8", "pytest", "pytest-cov", "pytest-dependency", "tomli"] +hard-encoding-detection = ["chardet"] +toml = ["tomli"] + [[package]] name = "colorama" version = "0.4.6" @@ -1487,4 +1504,4 @@ testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools" [metadata] lock-version = "2.0" python-versions = ">=3.8.1,<4" -content-hash = "2c17706acd15b04ba552a427bff732d35417eb38befdec71ced6b412946a3e01" +content-hash = "d902af9acf618afef153b274cd6f18e862ed52759a94ea12619f3699d1591b09" diff --git a/pyproject.toml b/pyproject.toml index 62dd40d8..83a5f9be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,6 +62,7 @@ pep8-naming = "^0.12.1" black = "^22.3.0" isort = "^5.10.1" pyright = "^1.1.239" +codespell = {extras = ["tomli"], version = "^2.2.2"} [tool.poetry.group.release.dependencies] towncrier = "^22.12.0" @@ -83,6 +84,9 @@ order_by_type = false case_sensitive = true combine_as_imports = true +[tool.codespell] +skip = "./.venv/*,./htmlcov/*,./.git,./.mypy_cache/*,./.pytest_cache/*" + [tool.pytest.ini_options] minversion = "6.0" asyncio_mode = "auto" @@ -140,6 +144,7 @@ black = "black ." isort = "isort ." pyright = "pyright ." flake8 = "flake8 ." +codespell = "codespell ." test = "pytest -v --failed-first" retest = "pytest -v --last-failed" test-nocov = "pytest -v --no-cov --failed-first" From 48e7b53cd8360155e76ca792c0500790fdbc53b2 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 29 Dec 2022 23:52:17 +0100 Subject: [PATCH 2/5] Add codespell to pre-commit --- .pre-commit-config.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b01945b0..f80042c5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -44,6 +44,15 @@ repos: language: system types: [python] + - repo: local + hooks: + - id: codespell + name: CodeSpell + description: Run code spell checker + entry: poetry run codespell + language: system + + - repo: local hooks: - id: pyright From 092d9c2566772e558588ca4564f8dafa33056a72 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 29 Dec 2022 23:52:34 +0100 Subject: [PATCH 3/5] Run codespell as a separate check in Validation workflow --- .github/workflows/validation.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index cd0bce05..e3b2bb95 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -27,7 +27,7 @@ jobs: install_args: "--without release" - name: Run pre-commit hooks - run: SKIP=black,isort,flake8,pyright pre-commit run --all-files + run: SKIP=black,isort,flake8,pyright,codespell pre-commit run --all-files - name: Run black formatter check run: black --check --diff . @@ -38,5 +38,8 @@ jobs: - name: Run flake8 linter run: flake8 . + - name: Run codespell linter + run: codespell . + - name: Run pyright type checker run: pyright . From e7feba85b6fb5a8e85fc5c9c0fcf33afe2c31334 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 29 Dec 2022 23:56:17 +0100 Subject: [PATCH 4/5] Fix several typos --- .github/workflows/prepare-release.yml | 4 ++-- CONTRIBUTING.md | 2 +- README.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index bbfa9f21..51f125ff 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -25,8 +25,8 @@ jobs: with: token: ${{ steps.generate_token.outputs.token }} - # Make the github application be the comitter - # (see: https://stackoverflow.com/a/74071223 on how to obtain the comitter email) + # Make the github application be the committer + # (see: https://stackoverflow.com/a/74071223 on how to obtain the committer email) - name: Setup git config run: | git config --global user.name "py-mine-ci-bot" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99c7896d..2760e87d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,7 +65,7 @@ Methods of marking PR as a draft: 1. When creating it ![image](https://user-images.githubusercontent.com/20902250/94499351-bc736e80-01fc-11eb-8e99-a7863dd1428a.png) -2. After it was crated +2. After it was created ![image](https://user-images.githubusercontent.com/20902250/94499276-8930df80-01fc-11eb-9292-7f0c6101b995.png) diff --git a/README.md b/README.md index f7f04669..fc5581bf 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ async def handshake(conn: TCPAsyncConnection, ip: str, port: int = 25565) -> Non # And now, it's time to send it! await conn.write_varint(len(packet)) # First field (size of packet id + data) - await conn.write(packet) # Second + Third fileds (packet id + data) + await conn.write(packet) # Second + Third fields (packet id + data) async def status(conn: TCPAsyncConnection, ip: str, port: int = 25565) -> dict: From be2ede8294f142ffe72a46449dd09f64290312d0 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 30 Dec 2022 00:03:19 +0100 Subject: [PATCH 5/5] Ignore Ned word (name) --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 83a5f9be..a58ba5d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -86,6 +86,7 @@ combine_as_imports = true [tool.codespell] skip = "./.venv/*,./htmlcov/*,./.git,./.mypy_cache/*,./.pytest_cache/*" +ignore-words-list = "ned" [tool.pytest.ini_options] minversion = "6.0"