mirror of
https://github.com/fastapi/fastapi.git
synced 2026-09-14 13:36:21 +08:00
👷 Add pre-commit to check typos (#15482)
This commit is contained in:
committed by
GitHub
parent
3efd86c1fd
commit
fb7429378d
@@ -14,6 +14,12 @@ repos:
|
|||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
|
|
||||||
|
- repo: https://github.com/crate-ci/typos
|
||||||
|
rev: bbaefadf97b0ec5fdc942684b647f1a6ab250274 # v1.46.0
|
||||||
|
hooks:
|
||||||
|
- id: typos
|
||||||
|
args: [--force-exclude]
|
||||||
|
|
||||||
- repo: local
|
- repo: local
|
||||||
hooks:
|
hooks:
|
||||||
- id: local-ruff-check
|
- id: local-ruff-check
|
||||||
|
|||||||
@@ -335,3 +335,40 @@ keep-runtime-typing = true
|
|||||||
[tool.inline-snapshot]
|
[tool.inline-snapshot]
|
||||||
# default-flags=["fix"]
|
# default-flags=["fix"]
|
||||||
# default-flags=["create"]
|
# 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"
|
||||||
|
|||||||
@@ -154,13 +154,16 @@ def test_post_missing_required_field_in_item(client: TestClient):
|
|||||||
def test_post_missing_required_field_in_user(client: TestClient):
|
def test_post_missing_required_field_in_user(client: TestClient):
|
||||||
response = client.put(
|
response = client.put(
|
||||||
"/items/5",
|
"/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.status_code == 422
|
||||||
assert response.json() == {
|
assert response.json() == {
|
||||||
"detail": [
|
"detail": [
|
||||||
{
|
{
|
||||||
"input": {"ful_name": "John Doe"},
|
"input": {"full_name": "John Doe"},
|
||||||
"loc": [
|
"loc": [
|
||||||
"body",
|
"body",
|
||||||
"user",
|
"user",
|
||||||
|
|||||||
@@ -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(
|
response = client.put(
|
||||||
"/items/5",
|
"/items/5",
|
||||||
json={
|
json={
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ def test_router_with_params():
|
|||||||
|
|
||||||
def test_wrong_uri():
|
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)
|
client = TestClient(app)
|
||||||
with pytest.raises(WebSocketDisconnect) as e:
|
with pytest.raises(WebSocketDisconnect) as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user