Enable Ruff TCH rules (#124396)

* Enable Ruff TCH rules

* Ignore TCH001-003

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
pull/124808/head
Sid 2024-08-28 18:01:41 +02:00 committed by GitHub
parent 03ead27f6c
commit 9153d16a6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -768,6 +768,7 @@ select = [
"SLOT", # flake8-slots
"T100", # Trace found: {name} used
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID251", # Banned imports
"TRY", # tryceratops
"UP", # pyupgrade
@ -800,6 +801,12 @@ ignore = [
"SIM103", # Return the condition {condition} directly
"SIM108", # Use ternary operator {contents} instead of if-else-block
"SIM115", # Use context handler for opening files
# Moving imports into type-checking blocks can mess with pytest.patch()
"TCH001", # Move application import {} into a type-checking block
"TCH002", # Move third-party import {} into a type-checking block
"TCH003", # Move standard library import {} into a type-checking block
"TRY003", # Avoid specifying long messages outside the exception class
"TRY400", # Use `logging.exception` instead of `logging.error`
# Ignored due to performance: https://github.com/charliermarsh/ruff/issues/2923