Skip to content

Commit dcebcca

Browse files
authored
🚨 Enable ARG001 to prevent unused arguments (fastapi#1152)
1 parent e3a023d commit dcebcca

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

‎backend/app/api/routes/users.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def update_password_me(
115115

116116

117117
@router.get("/me", response_model=UserOut)
118-
def read_user_me(session: SessionDep, current_user: CurrentUser) -> Any:
118+
def read_user_me(current_user: CurrentUser) -> Any:
119119
"""
120120
Get current user.
121121
"""

‎backend/app/tests/api/routes/test_items.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def test_create_item(
9-
client: TestClient, superuser_token_headers: dict[str, str], db: Session
9+
client: TestClient, superuser_token_headers: dict[str, str]
1010
) -> None:
1111
data = {"title": "Foo", "description": "Fighters"}
1212
response = client.post(
@@ -39,7 +39,7 @@ def test_read_item(
3939

4040

4141
def test_read_item_not_found(
42-
client: TestClient, superuser_token_headers: dict[str, str], db: Session
42+
client: TestClient, superuser_token_headers: dict[str, str]
4343
) -> None:
4444
response = client.get(
4545
f"{settings.API_V1_STR}/items/999",
@@ -96,7 +96,7 @@ def test_update_item(
9696

9797

9898
def test_update_item_not_found(
99-
client: TestClient, superuser_token_headers: dict[str, str], db: Session
99+
client: TestClient, superuser_token_headers: dict[str, str]
100100
) -> None:
101101
data = {"title": "Updated title", "description": "Updated description"}
102102
response = client.put(
@@ -138,7 +138,7 @@ def test_delete_item(
138138

139139

140140
def test_delete_item_not_found(
141-
client: TestClient, superuser_token_headers: dict[str, str], db: Session
141+
client: TestClient, superuser_token_headers: dict[str, str]
142142
) -> None:
143143
response = client.delete(
144144
f"{settings.API_V1_STR}/items/999",

‎backend/app/tests/api/routes/test_users.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_get_existing_user_current_user(client: TestClient, db: Session) -> None
101101

102102

103103
def test_get_existing_user_permissions_error(
104-
client: TestClient, normal_user_token_headers: dict[str, str], db: Session
104+
client: TestClient, normal_user_token_headers: dict[str, str]
105105
) -> None:
106106
r = client.get(
107107
f"{settings.API_V1_STR}/users/999999",
@@ -167,7 +167,7 @@ def test_retrieve_users(
167167

168168

169169
def test_update_user_me(
170-
client: TestClient, normal_user_token_headers: dict[str, str], db: Session
170+
client: TestClient, normal_user_token_headers: dict[str, str]
171171
) -> None:
172172
full_name = "Updated Name"
173173
email = random_email()
@@ -184,7 +184,7 @@ def test_update_user_me(
184184

185185

186186
def test_update_password_me(
187-
client: TestClient, superuser_token_headers: dict[str, str], db: Session
187+
client: TestClient, superuser_token_headers: dict[str, str]
188188
) -> None:
189189
new_password = random_lower_string()
190190
data = {
@@ -214,7 +214,7 @@ def test_update_password_me(
214214

215215

216216
def test_update_password_me_incorrect_password(
217-
client: TestClient, superuser_token_headers: dict[str, str], db: Session
217+
client: TestClient, superuser_token_headers: dict[str, str]
218218
) -> None:
219219
new_password = random_lower_string()
220220
data = {"current_password": new_password, "new_password": new_password}
@@ -247,7 +247,7 @@ def test_update_user_me_email_exists(
247247

248248

249249
def test_update_password_me_same_password_error(
250-
client: TestClient, superuser_token_headers: dict[str, str], db: Session
250+
client: TestClient, superuser_token_headers: dict[str, str]
251251
) -> None:
252252
data = {
253253
"current_password": settings.FIRST_SUPERUSER_PASSWORD,
@@ -337,7 +337,7 @@ def test_update_user(
337337

338338

339339
def test_update_user_not_exists(
340-
client: TestClient, superuser_token_headers: dict[str, str], db: Session
340+
client: TestClient, superuser_token_headers: dict[str, str]
341341
) -> None:
342342
data = {"full_name": "Updated_full_name"}
343343
r = client.patch(
@@ -415,7 +415,7 @@ def test_delete_user_current_user(client: TestClient, db: Session) -> None:
415415

416416

417417
def test_delete_user_not_found(
418-
client: TestClient, superuser_token_headers: dict[str, str], db: Session
418+
client: TestClient, superuser_token_headers: dict[str, str]
419419
) -> None:
420420
r = client.delete(
421421
f"{settings.API_V1_STR}/users/99999999",

‎backend/pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ select = [
5757
"B", # flake8-bugbear
5858
"C4", # flake8-comprehensions
5959
"UP", # pyupgrade
60+
"ARG001", # unused arguments in functions
6061
]
6162
ignore = [
6263
"E501", # line too long, handled by black

0 commit comments

Comments
 (0)