From fb7429378d14bd2d868abf145e1f18724b15e25d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 5 May 2026 11:44:36 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Add=20pre-commit=20to=20check=20?= =?UTF-8?q?typos=20(#15482)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 6 +++ pyproject.toml | 37 +++++++++++++++++++ ... test_response_set_response_code_empty.py} | 0 .../test_tutorial002.py | 7 +++- .../test_tutorial005.py | 2 +- tests/test_ws_router.py | 2 +- 6 files changed, 50 insertions(+), 4 deletions(-) rename tests/{test_reponse_set_reponse_code_empty.py => test_response_set_response_code_empty.py} (100%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7913c813ac..d304b78e8c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,6 +14,12 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace + - repo: https://github.com/crate-ci/typos + rev: bbaefadf97b0ec5fdc942684b647f1a6ab250274 # v1.46.0 + hooks: + - id: typos + args: [--force-exclude] + - repo: local hooks: - id: local-ruff-check diff --git a/pyproject.toml b/pyproject.toml index 8d8c4978d8..7abb9a33c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -335,3 +335,40 @@ keep-runtime-typing = true [tool.inline-snapshot] # default-flags=["fix"] # default-flags=["create"] + +[tool.typos.files] +extend-exclude = [ + "coverage/", + "dist/", + "docs/de/", + "docs/en/data/", + "docs/en/docs/img/", + "docs/en/docs/release-notes.md", + "docs/es/", + "docs/fr/", + "docs/ja/", + "docs/ko/", + "docs/language_names.yml", + "docs/pt/", + "docs/ru/", + "docs/tr/", + "docs/uk/", + "docs/zh/", + "docs/zh-hant/", + "htmlcov/", + "scripts/general-llm-prompt.md", + "scripts/tests/test_translation_fixer/test_complex_doc/", + "site/", + "site_build/", + "uv.lock", +] + +[tool.typos.default.extend-identifiers] +alls = "alls" + +[tool.typos.default.extend-words] +ba = "ba" +fo = "fo" +havin = "havin" +Ines = "Ines" +ser = "ser" diff --git a/tests/test_reponse_set_reponse_code_empty.py b/tests/test_response_set_response_code_empty.py similarity index 100% rename from tests/test_reponse_set_reponse_code_empty.py rename to tests/test_response_set_response_code_empty.py diff --git a/tests/test_tutorial/test_body_multiple_params/test_tutorial002.py b/tests/test_tutorial/test_body_multiple_params/test_tutorial002.py index b23402c3cb..b9b9928ba5 100644 --- a/tests/test_tutorial/test_body_multiple_params/test_tutorial002.py +++ b/tests/test_tutorial/test_body_multiple_params/test_tutorial002.py @@ -154,13 +154,16 @@ def test_post_missing_required_field_in_item(client: TestClient): def test_post_missing_required_field_in_user(client: TestClient): response = client.put( "/items/5", - json={"item": {"name": "Foo", "price": 50.5}, "user": {"ful_name": "John Doe"}}, + json={ + "item": {"name": "Foo", "price": 50.5}, + "user": {"full_name": "John Doe"}, + }, ) assert response.status_code == 422 assert response.json() == { "detail": [ { - "input": {"ful_name": "John Doe"}, + "input": {"full_name": "John Doe"}, "loc": [ "body", "user", diff --git a/tests/test_tutorial/test_body_multiple_params/test_tutorial005.py b/tests/test_tutorial/test_body_multiple_params/test_tutorial005.py index b8fc98cd7e..6186380c96 100644 --- a/tests/test_tutorial/test_body_multiple_params/test_tutorial005.py +++ b/tests/test_tutorial/test_body_multiple_params/test_tutorial005.py @@ -82,7 +82,7 @@ def test_post_no_body(client: TestClient): } -def test_post_like_not_embeded(client: TestClient): +def test_post_like_not_embedded(client: TestClient): response = client.put( "/items/5", json={ diff --git a/tests/test_ws_router.py b/tests/test_ws_router.py index 240a42bb0c..d8bcf17588 100644 --- a/tests/test_ws_router.py +++ b/tests/test_ws_router.py @@ -176,7 +176,7 @@ def test_router_with_params(): def test_wrong_uri(): """ - Verify that a websocket connection to a non-existent endpoing returns in a shutdown + Verify that a websocket connection to a non-existent endpoint returns in a shutdown """ client = TestClient(app) with pytest.raises(WebSocketDisconnect) as e: