From bbd111fef0147ed4137c26288974ce1058adb17e Mon Sep 17 00:00:00 2001 From: David Salvisberg Date: Mon, 18 Nov 2024 18:34:38 +0100 Subject: [PATCH] [ruff 0.8][`flake8-type-checking`] Rename `TCH` to `TC` (#14438) Closes #9573 --- .../{TCH001.py => TC001.py} | 2 +- .../{TCH002.py => TC002.py} | 20 +++--- .../{TCH003.py => TC003.py} | 2 +- .../{TCH004_1.py => TC004_1.py} | 0 .../{TCH004_10.py => TC004_10.py} | 0 .../{TCH004_11.py => TC004_11.py} | 0 .../{TCH004_12.py => TC004_12.py} | 0 .../{TCH004_13.py => TC004_13.py} | 0 .../{TCH004_14.pyi => TC004_14.pyi} | 0 .../{TCH004_15.py => TC004_15.py} | 0 .../{TCH004_16.py => TC004_16.py} | 0 .../{TCH004_17.py => TC004_17.py} | 0 .../{TCH004_2.py => TC004_2.py} | 0 .../{TCH004_3.py => TC004_3.py} | 0 .../{TCH004_4.py => TC004_4.py} | 0 .../{TCH004_5.py => TC004_5.py} | 0 .../{TCH004_6.py => TC004_6.py} | 0 .../{TCH004_7.py => TC004_7.py} | 0 .../{TCH004_8.py => TC004_8.py} | 0 .../{TCH004_9.py => TC004_9.py} | 0 .../{TCH005.py => TC005.py} | 12 ++-- .../fixtures/flake8_type_checking/TC010_1.py | 18 +++++ .../fixtures/flake8_type_checking/TC010_2.py | 16 +++++ .../fixtures/flake8_type_checking/TCH010_1.py | 18 ----- .../fixtures/flake8_type_checking/TCH010_2.py | 16 ----- .../runtime_evaluated_base_classes_1.py | 6 +- .../runtime_evaluated_base_classes_2.py | 4 +- .../runtime_evaluated_base_classes_3.py | 2 +- .../runtime_evaluated_decorators_1.py | 6 +- .../runtime_evaluated_decorators_2.py | 2 +- .../runtime_evaluated_decorators_3.py | 2 +- crates/ruff_linter/src/registry.rs | 2 +- crates/ruff_linter/src/rule_redirects.rs | 14 +++- .../src/rules/flake8_type_checking/mod.rs | 46 ++++++------- .../rules/empty_type_checking_block.rs | 2 +- .../runtime_import_in_type_checking_block.rs | 2 +- .../rules/runtime_string_union.rs | 2 +- .../rules/typing_only_runtime_import.rs | 2 +- ...__empty-type-checking-block_TC005.py.snap} | 54 +++++++-------- ..._type_checking__tests__exempt_modules.snap | 4 +- ...ke8_type_checking__tests__import_from.snap | 4 +- ...ests__import_from_type_checking_block.snap | 4 +- ...ype_checking__tests__multiple_members.snap | 8 +-- ...sts__multiple_modules_different_types.snap | 8 +-- ...ng__tests__multiple_modules_same_type.snap | 8 +-- ...ype_checking__tests__no_typing_import.snap | 4 +- ...mport-in-type-checking-block_quote.py.snap | 4 +- ...ping-only-third-party-import_quote.py.snap | 52 +++++++------- ...ing-only-third-party-import_quote2.py.snap | 36 +++++----- ...ing-only-third-party-import_quote3.py.snap | 28 ++++---- ...rt-in-type-checking-block_TC004_1.py.snap} | 4 +- ...t-in-type-checking-block_TC004_10.py.snap} | 0 ...t-in-type-checking-block_TC004_11.py.snap} | 4 +- ...t-in-type-checking-block_TC004_12.py.snap} | 4 +- ...t-in-type-checking-block_TC004_13.py.snap} | 0 ...-in-type-checking-block_TC004_14.pyi.snap} | 0 ...t-in-type-checking-block_TC004_15.py.snap} | 0 ...t-in-type-checking-block_TC004_16.py.snap} | 0 ...t-in-type-checking-block_TC004_17.py.snap} | 4 +- ...rt-in-type-checking-block_TC004_2.py.snap} | 4 +- ...rt-in-type-checking-block_TC004_3.py.snap} | 0 ...rt-in-type-checking-block_TC004_4.py.snap} | 4 +- ...rt-in-type-checking-block_TC004_5.py.snap} | 12 ++-- ...rt-in-type-checking-block_TC004_6.py.snap} | 0 ...rt-in-type-checking-block_TC004_7.py.snap} | 0 ...rt-in-type-checking-block_TC004_8.py.snap} | 0 ...rt-in-type-checking-block_TC004_9.py.snap} | 8 +-- ...mport-in-type-checking-block_quote.py.snap | 4 +- ...k_runtime_evaluated_base_classes_1.py.snap | 44 ++++++------ ...ock_runtime_evaluated_decorators_1.py.snap | 44 ++++++------ ...ests__runtime-string-union_TC010_1.py.snap | 11 +++ ...ests__runtime-string-union_TC010_2.py.snap | 40 +++++++++++ ...sts__runtime-string-union_TCH010_1.py.snap | 11 --- ...sts__runtime-string-union_TCH010_2.py.snap | 40 ----------- ...y-standard-library-import_init_var.py.snap | 8 +-- ...ly-standard-library-import_kw_only.py.snap | 4 +- ...ing-only-third-party-import_strict.py.snap | 32 ++++----- ...ests__type_checking_block_after_usage.snap | 4 +- ...g__tests__type_checking_block_comment.snap | 4 +- ...ng__tests__type_checking_block_inline.snap | 4 +- ...__tests__type_checking_block_own_line.snap | 4 +- ...ing-only-first-party-import_TC001.py.snap} | 6 +- ...nly-standard-library-import_TC003.py.snap} | 6 +- ...rary-import_exempt_type_checking_1.py.snap | 4 +- ...rary-import_exempt_type_checking_2.py.snap | 4 +- ...rary-import_exempt_type_checking_3.py.snap | 4 +- ...y-standard-library-import_init_var.py.snap | 4 +- ...d-library-import_module__undefined.py.snap | 4 +- ...t_runtime_evaluated_base_classes_3.py.snap | 8 +-- ...ort_runtime_evaluated_decorators_3.py.snap | 8 +-- ...ibrary-import_singledispatchmethod.py.snap | 4 +- ...ing-only-third-party-import_TC002.py.snap} | 68 +++++++++---------- ...t_runtime_evaluated_base_classes_2.py.snap | 24 +++---- ...ort_runtime_evaluated_decorators_2.py.snap | 8 +-- ...-third-party-import_singledispatch.py.snap | 4 +- ...ing-only-third-party-import_strict.py.snap | 8 +-- ...hird-party-import_typing_modules_1.py.snap | 4 +- ...hird-party-import_typing_modules_2.py.snap | 4 +- ...s__typing_import_after_package_import.snap | 4 +- ...ing__tests__typing_import_after_usage.snap | 4 +- ...__typing_import_before_package_import.snap | 4 +- ruff.schema.json | 20 +++--- 102 files changed, 460 insertions(+), 452 deletions(-) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH001.py => TC001.py} (82%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH002.py => TC002.py} (83%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH003.py => TC003.py} (71%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_1.py => TC004_1.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_10.py => TC004_10.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_11.py => TC004_11.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_12.py => TC004_12.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_13.py => TC004_13.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_14.pyi => TC004_14.pyi} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_15.py => TC004_15.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_16.py => TC004_16.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_17.py => TC004_17.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_2.py => TC004_2.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_3.py => TC004_3.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_4.py => TC004_4.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_5.py => TC004_5.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_6.py => TC004_6.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_7.py => TC004_7.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_8.py => TC004_8.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH004_9.py => TC004_9.py} (100%) rename crates/ruff_linter/resources/test/fixtures/flake8_type_checking/{TCH005.py => TC005.py} (80%) create mode 100644 crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC010_1.py create mode 100644 crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC010_2.py delete mode 100644 crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH010_1.py delete mode 100644 crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH010_2.py rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap => ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TC005.py.snap} (61%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_1.py.snap} (70%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_10.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_10.py.snap} (100%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_11.py.snap} (71%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_12.py.snap} (74%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_13.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_13.py.snap} (100%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_14.pyi.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_14.pyi.snap} (100%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_15.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_15.py.snap} (100%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_16.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_16.py.snap} (100%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_17.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_17.py.snap} (73%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_2.py.snap} (70%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_3.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_3.py.snap} (100%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_4.py.snap} (72%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_5.py.snap} (71%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_6.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_6.py.snap} (100%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_7.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_7.py.snap} (100%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_8.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_8.py.snap} (100%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap => ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_9.py.snap} (70%) create mode 100644 crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_1.py.snap create mode 100644 crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_2.py.snap delete mode 100644 crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_1.py.snap delete mode 100644 crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_2.py.snap rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap => ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TC001.py.snap} (75%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap => ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TC003.py.snap} (70%) rename crates/ruff_linter/src/rules/flake8_type_checking/snapshots/{ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap => ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TC002.py.snap} (70%) diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH001.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC001.py similarity index 82% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH001.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC001.py index c85cf3874b0bb..960392e98c5ab 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH001.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC001.py @@ -1,6 +1,6 @@ """Tests to determine first-party import classification. -For typing-only import detection tests, see `TCH002.py`. +For typing-only import detection tests, see `TC002.py`. """ diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH002.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC002.py similarity index 83% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH002.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC002.py index d3c36312eea7a..fdb73a9cf13c8 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH002.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC002.py @@ -2,49 +2,49 @@ def f(): - import pandas as pd # TCH002 + import pandas as pd # TC002 x: pd.DataFrame def f(): - from pandas import DataFrame # TCH002 + from pandas import DataFrame # TC002 x: DataFrame def f(): - from pandas import DataFrame as df # TCH002 + from pandas import DataFrame as df # TC002 x: df def f(): - import pandas as pd # TCH002 + import pandas as pd # TC002 x: pd.DataFrame = 1 def f(): - from pandas import DataFrame # TCH002 + from pandas import DataFrame # TC002 x: DataFrame = 2 def f(): - from pandas import DataFrame as df # TCH002 + from pandas import DataFrame as df # TC002 x: df = 3 def f(): - import pandas as pd # TCH002 + import pandas as pd # TC002 x: "pd.DataFrame" = 1 def f(): - import pandas as pd # TCH002 + import pandas as pd # TC002 x = dict["pd.DataFrame", "pd.DataFrame"] @@ -153,13 +153,13 @@ def f(): def f(): - from pandas import DataFrame # noqa: TCH002 + from pandas import DataFrame # noqa: TC002 x: DataFrame = 2 def f(): - from pandas import ( # noqa: TCH002 + from pandas import ( # noqa: TC002 DataFrame, ) diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH003.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC003.py similarity index 71% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH003.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC003.py index 663af2335a0ee..d9dd926e4272e 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH003.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC003.py @@ -1,6 +1,6 @@ """Tests to determine standard library import classification. -For typing-only import detection tests, see `TCH002.py`. +For typing-only import detection tests, see `TC002.py`. """ diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_1.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_1.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_1.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_1.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_10.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_10.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_10.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_10.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_11.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_11.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_11.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_11.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_12.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_12.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_12.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_12.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_13.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_13.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_13.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_13.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_14.pyi b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_14.pyi similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_14.pyi rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_14.pyi diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_15.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_15.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_15.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_15.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_16.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_16.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_16.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_16.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_17.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_17.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_17.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_17.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_2.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_2.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_2.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_2.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_3.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_3.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_3.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_3.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_4.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_4.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_4.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_4.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_5.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_5.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_5.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_5.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_6.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_6.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_6.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_6.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_7.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_7.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_7.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_7.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_8.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_8.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_8.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_8.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_9.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_9.py similarity index 100% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH004_9.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC004_9.py diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH005.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC005.py similarity index 80% rename from crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH005.py rename to crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC005.py index 7817da6848e46..dc5ce7c75e60e 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH005.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC005.py @@ -1,25 +1,25 @@ from typing import TYPE_CHECKING, List if TYPE_CHECKING: - pass # TCH005 + pass # TC005 if False: - pass # TCH005 + pass # TC005 if 0: - pass # TCH005 + pass # TC005 def example(): if TYPE_CHECKING: - pass # TCH005 + pass # TC005 return class Test: if TYPE_CHECKING: - pass # TCH005 + pass # TC005 x = 2 @@ -42,7 +42,7 @@ class Test: from typing_extensions import TYPE_CHECKING if TYPE_CHECKING: - pass # TCH005 + pass # TC005 # https://github.com/astral-sh/ruff/issues/11368 if TYPE_CHECKING: diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC010_1.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC010_1.py new file mode 100644 index 0000000000000..268173c56753a --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC010_1.py @@ -0,0 +1,18 @@ +from __future__ import annotations + +from typing import TypeVar + + +x: "int" | str # TC010 +x: ("int" | str) | "bool" # TC010 + + +def func(): + x: "int" | str # OK + + +z: list[str, str | "int"] = [] # TC010 + +type A = Value["int" | str] # OK + +OldS = TypeVar('OldS', int | 'str', str) # TC010 diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC010_2.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC010_2.py new file mode 100644 index 0000000000000..ee4c4e56ea05b --- /dev/null +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TC010_2.py @@ -0,0 +1,16 @@ +from typing import TypeVar + + +x: "int" | str # TC010 +x: ("int" | str) | "bool" # TC010 + + +def func(): + x: "int" | str # OK + + +z: list[str, str | "int"] = [] # TC010 + +type A = Value["int" | str] # OK + +OldS = TypeVar('OldS', int | 'str', str) # TC010 diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH010_1.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH010_1.py deleted file mode 100644 index d640994930ad8..0000000000000 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH010_1.py +++ /dev/null @@ -1,18 +0,0 @@ -from __future__ import annotations - -from typing import TypeVar - - -x: "int" | str # TCH010 -x: ("int" | str) | "bool" # TCH010 - - -def func(): - x: "int" | str # OK - - -z: list[str, str | "int"] = [] # TCH010 - -type A = Value["int" | str] # OK - -OldS = TypeVar('OldS', int | 'str', str) # TCH010 diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH010_2.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH010_2.py deleted file mode 100644 index 09fae9a5e6c93..0000000000000 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/TCH010_2.py +++ /dev/null @@ -1,16 +0,0 @@ -from typing import TypeVar - - -x: "int" | str # TCH010 -x: ("int" | str) | "bool" # TCH010 - - -def func(): - x: "int" | str # OK - - -z: list[str, str | "int"] = [] # TCH010 - -type A = Value["int" | str] # OK - -OldS = TypeVar('OldS', int | 'str', str) # TCH010 diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_1.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_1.py index d578d95841e88..418b0b28081f4 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_1.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_1.py @@ -7,10 +7,10 @@ from pydantic import BaseModel if TYPE_CHECKING: - import datetime # TCH004 - from array import array # TCH004 + import datetime # TC004 + from array import array # TC004 - import pandas # TCH004 + import pandas # TC004 import pyproj diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_2.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_2.py index b54bf2e9c48f2..65d89487655a1 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_2.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_2.py @@ -1,8 +1,8 @@ from __future__ import annotations -import geopandas as gpd # TCH002 +import geopandas as gpd # TC002 import pydantic -import pyproj # TCH002 +import pyproj # TC002 from pydantic import BaseModel import numpy diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_3.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_3.py index 98527b019dee0..a4caaacb00b97 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_3.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_base_classes_3.py @@ -2,7 +2,7 @@ import datetime import pathlib -from uuid import UUID # TCH003 +from uuid import UUID # TC003 import pydantic from pydantic import BaseModel diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_1.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_1.py index fbc22a3aad52e..a37ca8fc4424a 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_1.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_1.py @@ -9,10 +9,10 @@ import numpy if TYPE_CHECKING: - import datetime # TCH004 - from array import array # TCH004 + import datetime # TC004 + from array import array # TC004 - import pandas # TCH004 + import pandas # TC004 import pyproj diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_2.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_2.py index 825dd37ca023d..bdf197f4aab12 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_2.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_2.py @@ -7,7 +7,7 @@ import pyproj from attrs import frozen -import numpy # TCH002 +import numpy # TC002 @attrs.define(auto_attribs=True) diff --git a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_3.py b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_3.py index fd433772f851a..6991d342d0584 100644 --- a/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_3.py +++ b/crates/ruff_linter/resources/test/fixtures/flake8_type_checking/runtime_evaluated_decorators_3.py @@ -3,7 +3,7 @@ import datetime from array import array from dataclasses import dataclass -from uuid import UUID # TCH003 +from uuid import UUID # TC003 from collections.abc import Sequence from pydantic import validate_call diff --git a/crates/ruff_linter/src/registry.rs b/crates/ruff_linter/src/registry.rs index 1ee0cc5102add..d20bc6a482d58 100644 --- a/crates/ruff_linter/src/registry.rs +++ b/crates/ruff_linter/src/registry.rs @@ -155,7 +155,7 @@ pub enum Linter { #[prefix = "TID"] Flake8TidyImports, /// [flake8-type-checking](https://pypi.org/project/flake8-type-checking/) - #[prefix = "TCH"] + #[prefix = "TC"] Flake8TypeChecking, /// [flake8-gettext](https://pypi.org/project/flake8-gettext/) #[prefix = "INT"] diff --git a/crates/ruff_linter/src/rule_redirects.rs b/crates/ruff_linter/src/rule_redirects.rs index ccbd4ca571627..2975f7c734710 100644 --- a/crates/ruff_linter/src/rule_redirects.rs +++ b/crates/ruff_linter/src/rule_redirects.rs @@ -87,8 +87,8 @@ static REDIRECTS: LazyLock> = LazyLock::new( ("PDV90", "PD90"), ("PDV901", "PD901"), // TODO(charlie): Remove by 2023-04-01. - ("TYP", "TCH"), - ("TYP001", "TCH001"), + ("TYP", "TC"), + ("TYP001", "TC001"), // TODO(charlie): Remove by 2023-06-01. ("RUF004", "B026"), ("PIE802", "C419"), @@ -98,7 +98,6 @@ static REDIRECTS: LazyLock> = LazyLock::new( ("T003", "FIX003"), ("T004", "FIX004"), ("RUF011", "B035"), - ("TCH006", "TCH010"), ("TRY200", "B904"), ("PGH001", "S307"), ("PGH002", "G010"), @@ -126,5 +125,14 @@ static REDIRECTS: LazyLock> = LazyLock::new( ("RUF025", "C420"), // See: https://github.com/astral-sh/ruff/issues/13492 ("TRY302", "TRY203"), + // TCH renamed to TC to harmonize with flake8 plugin + ("TCH", "TC"), + ("TCH001", "TC001"), + ("TCH002", "TC002"), + ("TCH003", "TC003"), + ("TCH004", "TC004"), + ("TCH005", "TC005"), + ("TCH006", "TC010"), + ("TCH010", "TC010"), ]) }); diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/mod.rs b/crates/ruff_linter/src/rules/flake8_type_checking/mod.rs index ba57420f672a0..2e903ca965bd2 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/mod.rs +++ b/crates/ruff_linter/src/rules/flake8_type_checking/mod.rs @@ -16,29 +16,29 @@ mod tests { use crate::test::{test_path, test_snippet}; use crate::{assert_messages, settings}; - #[test_case(Rule::EmptyTypeCheckingBlock, Path::new("TCH005.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_1.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_10.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_11.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_12.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_13.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_14.pyi"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_15.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_16.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_17.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_2.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_3.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_4.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_5.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_6.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_7.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_8.py"))] - #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TCH004_9.py"))] + #[test_case(Rule::EmptyTypeCheckingBlock, Path::new("TC005.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_1.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_10.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_11.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_12.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_13.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_14.pyi"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_15.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_16.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_17.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_2.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_3.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_4.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_5.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_6.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_7.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_8.py"))] + #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("TC004_9.py"))] #[test_case(Rule::RuntimeImportInTypeCheckingBlock, Path::new("quote.py"))] - #[test_case(Rule::RuntimeStringUnion, Path::new("TCH010_1.py"))] - #[test_case(Rule::RuntimeStringUnion, Path::new("TCH010_2.py"))] - #[test_case(Rule::TypingOnlyFirstPartyImport, Path::new("TCH001.py"))] - #[test_case(Rule::TypingOnlyStandardLibraryImport, Path::new("TCH003.py"))] + #[test_case(Rule::RuntimeStringUnion, Path::new("TC010_1.py"))] + #[test_case(Rule::RuntimeStringUnion, Path::new("TC010_2.py"))] + #[test_case(Rule::TypingOnlyFirstPartyImport, Path::new("TC001.py"))] + #[test_case(Rule::TypingOnlyStandardLibraryImport, Path::new("TC003.py"))] #[test_case(Rule::TypingOnlyStandardLibraryImport, Path::new("init_var.py"))] #[test_case(Rule::TypingOnlyStandardLibraryImport, Path::new("kw_only.py"))] #[test_case(Rule::TypingOnlyStandardLibraryImport, Path::new("snapshot.py"))] @@ -46,7 +46,7 @@ mod tests { Rule::TypingOnlyStandardLibraryImport, Path::new("singledispatchmethod.py") )] - #[test_case(Rule::TypingOnlyThirdPartyImport, Path::new("TCH002.py"))] + #[test_case(Rule::TypingOnlyThirdPartyImport, Path::new("TC002.py"))] #[test_case(Rule::TypingOnlyThirdPartyImport, Path::new("quote.py"))] #[test_case(Rule::TypingOnlyThirdPartyImport, Path::new("singledispatch.py"))] #[test_case(Rule::TypingOnlyThirdPartyImport, Path::new("strict.py"))] diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/rules/empty_type_checking_block.rs b/crates/ruff_linter/src/rules/flake8_type_checking/rules/empty_type_checking_block.rs index 2eb141ca3b08f..0935425b718c7 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/rules/empty_type_checking_block.rs +++ b/crates/ruff_linter/src/rules/flake8_type_checking/rules/empty_type_checking_block.rs @@ -46,7 +46,7 @@ impl AlwaysFixableViolation for EmptyTypeCheckingBlock { } } -/// TCH005 +/// TC005 pub(crate) fn empty_type_checking_block(checker: &mut Checker, stmt: &ast::StmtIf) { if !typing::is_type_checking_block(stmt, checker.semantic()) { return; diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/rules/runtime_import_in_type_checking_block.rs b/crates/ruff_linter/src/rules/flake8_type_checking/rules/runtime_import_in_type_checking_block.rs index cbb55d82fef10..3444dfc5031f3 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/rules/runtime_import_in_type_checking_block.rs +++ b/crates/ruff_linter/src/rules/flake8_type_checking/rules/runtime_import_in_type_checking_block.rs @@ -96,7 +96,7 @@ enum Action { Ignore, } -/// TCH004 +/// TC004 pub(crate) fn runtime_import_in_type_checking_block( checker: &Checker, scope: &Scope, diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/rules/runtime_string_union.rs b/crates/ruff_linter/src/rules/flake8_type_checking/rules/runtime_string_union.rs index 380115e38deb8..ddeb010770a4c 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/rules/runtime_string_union.rs +++ b/crates/ruff_linter/src/rules/flake8_type_checking/rules/runtime_string_union.rs @@ -51,7 +51,7 @@ impl Violation for RuntimeStringUnion { } } -/// TCH006 +/// TC006 pub(crate) fn runtime_string_union(checker: &mut Checker, expr: &Expr) { if !checker.semantic().in_type_definition() { return; diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/rules/typing_only_runtime_import.rs b/crates/ruff_linter/src/rules/flake8_type_checking/rules/typing_only_runtime_import.rs index a9a43b4ec86b7..8bd9d57c0e257 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/rules/typing_only_runtime_import.rs +++ b/crates/ruff_linter/src/rules/flake8_type_checking/rules/typing_only_runtime_import.rs @@ -243,7 +243,7 @@ impl Violation for TypingOnlyStandardLibraryImport { } } -/// TCH001, TCH002, TCH003 +/// TC001, TC002, TC003 pub(crate) fn typing_only_runtime_import( checker: &Checker, scope: &Scope, diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TC005.py.snap similarity index 61% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TC005.py.snap index c031566e4ff93..14fc75ff7368c 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TCH005.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__empty-type-checking-block_TC005.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH005.py:4:5: TCH005 [*] Found empty type-checking block +TC005.py:4:5: TC005 [*] Found empty type-checking block | 3 | if TYPE_CHECKING: -4 | pass # TCH005 - | ^^^^ TCH005 +4 | pass # TC005 + | ^^^^ TC005 | = help: Delete empty type-checking block @@ -14,55 +14,55 @@ TCH005.py:4:5: TCH005 [*] Found empty type-checking block 1 1 | from typing import TYPE_CHECKING, List 2 2 | 3 |-if TYPE_CHECKING: -4 |- pass # TCH005 +4 |- pass # TC005 5 3 | 6 4 | 7 5 | if False: -TCH005.py:8:5: TCH005 [*] Found empty type-checking block +TC005.py:8:5: TC005 [*] Found empty type-checking block | 7 | if False: - 8 | pass # TCH005 - | ^^^^ TCH005 + 8 | pass # TC005 + | ^^^^ TC005 9 | 10 | if 0: | = help: Delete empty type-checking block ℹ Safe fix -4 4 | pass # TCH005 +4 4 | pass # TC005 5 5 | 6 6 | 7 |-if False: -8 |- pass # TCH005 +8 |- pass # TC005 9 7 | 10 8 | if 0: -11 9 | pass # TCH005 +11 9 | pass # TC005 -TCH005.py:11:5: TCH005 [*] Found empty type-checking block +TC005.py:11:5: TC005 [*] Found empty type-checking block | 10 | if 0: -11 | pass # TCH005 - | ^^^^ TCH005 +11 | pass # TC005 + | ^^^^ TC005 | = help: Delete empty type-checking block ℹ Safe fix 7 7 | if False: -8 8 | pass # TCH005 +8 8 | pass # TC005 9 9 | 10 |-if 0: -11 |- pass # TCH005 +11 |- pass # TC005 12 10 | 13 11 | 14 12 | def example(): -TCH005.py:16:9: TCH005 [*] Found empty type-checking block +TC005.py:16:9: TC005 [*] Found empty type-checking block | 14 | def example(): 15 | if TYPE_CHECKING: -16 | pass # TCH005 - | ^^^^ TCH005 +16 | pass # TC005 + | ^^^^ TC005 17 | return | = help: Delete empty type-checking block @@ -72,17 +72,17 @@ TCH005.py:16:9: TCH005 [*] Found empty type-checking block 13 13 | 14 14 | def example(): 15 |- if TYPE_CHECKING: -16 |- pass # TCH005 +16 |- pass # TC005 17 15 | return 18 16 | 19 17 | -TCH005.py:22:9: TCH005 [*] Found empty type-checking block +TC005.py:22:9: TC005 [*] Found empty type-checking block | 20 | class Test: 21 | if TYPE_CHECKING: -22 | pass # TCH005 - | ^^^^ TCH005 +22 | pass # TC005 + | ^^^^ TC005 23 | x = 2 | = help: Delete empty type-checking block @@ -92,16 +92,16 @@ TCH005.py:22:9: TCH005 [*] Found empty type-checking block 19 19 | 20 20 | class Test: 21 |- if TYPE_CHECKING: -22 |- pass # TCH005 +22 |- pass # TC005 23 21 | x = 2 24 22 | 25 23 | -TCH005.py:45:5: TCH005 [*] Found empty type-checking block +TC005.py:45:5: TC005 [*] Found empty type-checking block | 44 | if TYPE_CHECKING: -45 | pass # TCH005 - | ^^^^ TCH005 +45 | pass # TC005 + | ^^^^ TC005 46 | 47 | # https://github.com/astral-sh/ruff/issues/11368 | @@ -112,7 +112,7 @@ TCH005.py:45:5: TCH005 [*] Found empty type-checking block 42 42 | from typing_extensions import TYPE_CHECKING 43 43 | 44 |-if TYPE_CHECKING: -45 |- pass # TCH005 +45 |- pass # TC005 46 44 | 47 45 | # https://github.com/astral-sh/ruff/issues/11368 48 46 | if TYPE_CHECKING: diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap index fe74f7cac29f1..215264924b407 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__exempt_modules.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -exempt_modules.py:14:12: TCH002 [*] Move third-party import `flask` into a type-checking block +exempt_modules.py:14:12: TC002 [*] Move third-party import `flask` into a type-checking block | 13 | def f(): 14 | import flask - | ^^^^^ TCH002 + | ^^^^^ TC002 15 | 16 | x: flask | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap index 1446fb82c6507..d289137f6e3fd 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:5:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +:5:5: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 4 | from pandas import ( 5 | DataFrame, # DataFrame - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 6 | Series, # Series 7 | ) | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap index b7f4fd394ef27..2d61a1e9c93d5 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__import_from_type_checking_block.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:7:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +:7:5: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 6 | from pandas import ( 7 | DataFrame, # DataFrame - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 8 | Series, # Series 9 | ) | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap index 4e3d85fa50d88..718590d0fb862 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_members.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:7:5: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +:7:5: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 6 | from pandas import ( 7 | DataFrame, # DataFrame - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 8 | Series, # Series 9 | ) | @@ -30,12 +30,12 @@ snapshot_kind: text 11 13 | def f(x: DataFrame, y: Series): 12 14 | pass -:8:5: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block +:8:5: TC002 [*] Move third-party import `pandas.Series` into a type-checking block | 6 | from pandas import ( 7 | DataFrame, # DataFrame 8 | Series, # Series - | ^^^^^^ TCH002 + | ^^^^^^ TC002 9 | ) | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap index 8e5f319bb593b..e8300136de4ca 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_different_types.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:6:8: TCH003 [*] Move standard library import `os` into a type-checking block +:6:8: TC003 [*] Move standard library import `os` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | 6 | import os, pandas - | ^^ TCH003 + | ^^ TC003 7 | 8 | def f(x: os, y: pandas): | @@ -26,12 +26,12 @@ snapshot_kind: text 8 11 | def f(x: os, y: pandas): 9 12 | pass -:6:12: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:12: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | 6 | import os, pandas - | ^^^^^^ TCH002 + | ^^^^^^ TC002 7 | 8 | def f(x: os, y: pandas): | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap index 379e54153767a..aa2a82e116641 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__multiple_modules_same_type.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:6:8: TCH003 [*] Move standard library import `os` into a type-checking block +:6:8: TC003 [*] Move standard library import `os` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | 6 | import os, sys - | ^^ TCH003 + | ^^ TC003 7 | 8 | def f(x: os, y: sys): | @@ -25,12 +25,12 @@ snapshot_kind: text 8 10 | def f(x: os, y: sys): 9 11 | pass -:6:12: TCH003 [*] Move standard library import `sys` into a type-checking block +:6:12: TC003 [*] Move standard library import `sys` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | 6 | import os, sys - | ^^^ TCH003 + | ^^^ TC003 7 | 8 | def f(x: os, y: sys): | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap index 9ad0fda0a8cdc..8b3c5b1c1a5be 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__no_typing_import.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:4:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:4:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 2 | from __future__ import annotations 3 | 4 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 5 | 6 | def f(x: pd.DataFrame): | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap index a7faea4767757..dc77edcf61d24 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -quote.py:57:28: TCH004 [*] Quote references to `pandas.DataFrame`. Import is in a type-checking block. +quote.py:57:28: TC004 [*] Quote references to `pandas.DataFrame`. Import is in a type-checking block. | 56 | if TYPE_CHECKING: 57 | from pandas import DataFrame - | ^^^^^^^^^ TCH004 + | ^^^^^^^^^ TC004 58 | 59 | def func(value: DataFrame): | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap index 41ed6558a21ac..593464accbda6 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -quote.py:2:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +quote.py:2:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 1 | def f(): 2 | from pandas import DataFrame - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 3 | 4 | def baz() -> DataFrame: | @@ -26,11 +26,11 @@ quote.py:2:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type 6 9 | 7 10 | -quote.py:9:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +quote.py:9:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 8 | def f(): 9 | from pandas import DataFrame - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 10 | 11 | def baz() -> DataFrame[int]: | @@ -56,11 +56,11 @@ quote.py:9:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type 13 16 | 14 17 | -quote.py:16:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +quote.py:16:22: TC002 [*] Move third-party import `pandas` into a type-checking block | 15 | def f(): 16 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 17 | 18 | def baz() -> pd.DataFrame: | @@ -86,11 +86,11 @@ quote.py:16:22: TCH002 [*] Move third-party import `pandas` into a type-checking 20 23 | 21 24 | -quote.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +quote.py:23:22: TC002 [*] Move third-party import `pandas` into a type-checking block | 22 | def f(): 23 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 24 | 25 | def baz() -> pd.DataFrame.Extra: | @@ -116,11 +116,11 @@ quote.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checking 27 30 | 28 31 | -quote.py:30:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +quote.py:30:22: TC002 [*] Move third-party import `pandas` into a type-checking block | 29 | def f(): 30 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 31 | 32 | def baz() -> pd.DataFrame | int: | @@ -146,11 +146,11 @@ quote.py:30:22: TCH002 [*] Move third-party import `pandas` into a type-checking 34 37 | 35 38 | -quote.py:38:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +quote.py:38:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 37 | def f(): 38 | from pandas import DataFrame - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 39 | 40 | def baz() -> DataFrame(): | @@ -176,12 +176,12 @@ quote.py:38:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ 42 45 | 43 46 | -quote.py:47:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +quote.py:47:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 45 | from typing import Literal 46 | 47 | from pandas import DataFrame - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 48 | 49 | def baz() -> DataFrame[Literal["int"]]: | @@ -207,11 +207,11 @@ quote.py:47:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ 51 54 | 52 55 | -quote.py:64:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +quote.py:64:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 63 | def f(): 64 | from pandas import DataFrame, Series - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 65 | 66 | def baz() -> DataFrame | Series: | @@ -237,11 +237,11 @@ quote.py:64:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ 68 71 | 69 72 | -quote.py:64:35: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block +quote.py:64:35: TC002 [*] Move third-party import `pandas.Series` into a type-checking block | 63 | def f(): 64 | from pandas import DataFrame, Series - | ^^^^^^ TCH002 + | ^^^^^^ TC002 65 | 66 | def baz() -> DataFrame | Series: | @@ -267,11 +267,11 @@ quote.py:64:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c 68 71 | 69 72 | -quote.py:71:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +quote.py:71:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 70 | def f(): 71 | from pandas import DataFrame, Series - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 72 | 73 | def baz() -> ( | @@ -310,11 +310,11 @@ quote.py:71:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ 86 86 | 87 87 | -quote.py:71:35: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block +quote.py:71:35: TC002 [*] Move third-party import `pandas.Series` into a type-checking block | 70 | def f(): 71 | from pandas import DataFrame, Series - | ^^^^^^ TCH002 + | ^^^^^^ TC002 72 | 73 | def baz() -> ( | @@ -353,11 +353,11 @@ quote.py:71:35: TCH002 [*] Move third-party import `pandas.Series` into a type-c 86 86 | 87 87 | -quote.py:89:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +quote.py:89:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 88 | def f(): 89 | from pandas import DataFrame, Series - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 90 | 91 | def func(self) -> DataFrame | list[Series]: | @@ -383,11 +383,11 @@ quote.py:89:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a typ 93 96 | 94 97 | -quote.py:89:35: TCH002 [*] Move third-party import `pandas.Series` into a type-checking block +quote.py:89:35: TC002 [*] Move third-party import `pandas.Series` into a type-checking block | 88 | def f(): 89 | from pandas import DataFrame, Series - | ^^^^^^ TCH002 + | ^^^^^^ TC002 90 | 91 | def func(self) -> DataFrame | list[Series]: | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote2.py.snap index 2554aae580bc9..7401bf3092bca 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote2.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -quote2.py:2:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote2.py:2:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 1 | def f(): 2 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 3 | 4 | def test_remove_inner_quotes_double(self, user: AbstractBaseUser["int"]): | @@ -26,11 +26,11 @@ quote2.py:2:44: TCH002 [*] Move third-party import `django.contrib.auth.models.A 6 9 | 7 10 | -quote2.py:9:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote2.py:9:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 8 | def f(): 9 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 10 | 11 | def test_remove_inner_quotes_single(self, user: AbstractBaseUser['int']): | @@ -56,11 +56,11 @@ quote2.py:9:44: TCH002 [*] Move third-party import `django.contrib.auth.models.A 13 16 | 14 17 | -quote2.py:16:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote2.py:16:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 15 | def f(): 16 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 17 | 18 | def test_remove_inner_quotes_mixed(self, user: AbstractBaseUser['int', "str"]): | @@ -86,12 +86,12 @@ quote2.py:16:44: TCH002 [*] Move third-party import `django.contrib.auth.models. 20 23 | 21 24 | -quote2.py:25:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote2.py:25:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 23 | from typing import Annotated, Literal 24 | 25 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 26 | 27 | def test_literal_annotation_args_contain_quotes(self, type1: AbstractBaseUser[Literal["user", "admin"], Annotated["int", "1", 2]]): | @@ -117,12 +117,12 @@ quote2.py:25:44: TCH002 [*] Move third-party import `django.contrib.auth.models. 29 32 | 30 33 | -quote2.py:34:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote2.py:34:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 32 | from typing import Literal 33 | 34 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 35 | 36 | def test_union_contain_inner_quotes(self, type1: AbstractBaseUser["int" | Literal["int"]]): | @@ -148,12 +148,12 @@ quote2.py:34:44: TCH002 [*] Move third-party import `django.contrib.auth.models. 38 41 | 39 42 | -quote2.py:43:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote2.py:43:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 41 | from typing import Literal 42 | 43 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 44 | 45 | def test_inner_literal_mixed_quotes(user: AbstractBaseUser[Literal['user', "admin"]]): | @@ -179,12 +179,12 @@ quote2.py:43:44: TCH002 [*] Move third-party import `django.contrib.auth.models. 47 50 | 48 51 | -quote2.py:52:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote2.py:52:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 50 | from typing import Literal 51 | 52 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 53 | 54 | def test_inner_literal_single_quote(user: AbstractBaseUser[Literal['int'], str]): | @@ -210,12 +210,12 @@ quote2.py:52:44: TCH002 [*] Move third-party import `django.contrib.auth.models. 56 59 | 57 60 | -quote2.py:61:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote2.py:61:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 59 | from typing import Literal 60 | 61 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 62 | 63 | def test_mixed_quotes_literal(user: AbstractBaseUser[Literal['user'], "int"]): | @@ -241,12 +241,12 @@ quote2.py:61:44: TCH002 [*] Move third-party import `django.contrib.auth.models. 65 68 | 66 69 | -quote2.py:70:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote2.py:70:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 68 | from typing import Annotated, Literal 69 | 70 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 71 | 72 | def test_annotated_literal_mixed_quotes(user: AbstractBaseUser[Annotated[str, "max_length=20", Literal['user', "admin"]]]): | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote3.py.snap index 1f51c7afe8cbe..a4a7b7e57a8b0 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_typing-only-third-party-import_quote3.py.snap @@ -1,12 +1,12 @@ --- source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs --- -quote3.py:4:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote3.py:4:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 2 | from typing import Literal, Union 3 | 4 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 5 | 6 | def test_union_literal_mixed_quotes(user: AbstractBaseUser[Union[Literal['active', "inactive"], str]]): | @@ -28,12 +28,12 @@ quote3.py:4:44: TCH002 [*] Move third-party import `django.contrib.auth.models.A 8 11 | 9 12 | -quote3.py:13:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote3.py:13:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 11 | from typing import Callable, Literal 12 | 13 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 14 | 15 | def test_callable_literal_mixed_quotes(callable_fn: AbstractBaseUser[Callable[["int", Literal['admin', "user"]], 'bool']]): | @@ -59,12 +59,12 @@ quote3.py:13:44: TCH002 [*] Move third-party import `django.contrib.auth.models. 17 20 | 18 21 | -quote3.py:22:44: TCH002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block +quote3.py:22:44: TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block | 20 | from typing import Annotated, Callable, Literal 21 | 22 | from django.contrib.auth.models import AbstractBaseUser - | ^^^^^^^^^^^^^^^^ TCH002 + | ^^^^^^^^^^^^^^^^ TC002 23 | 24 | def test_callable_annotated_literal(callable_fn: AbstractBaseUser[Callable[[int, Annotated[str, Literal['active', "inactive"]]], bool]]): | @@ -90,12 +90,12 @@ quote3.py:22:44: TCH002 [*] Move third-party import `django.contrib.auth.models. 26 29 | 27 30 | -quote3.py:31:37: TCH002 [*] Move third-party import `django.contrib.auth.models` into a type-checking block +quote3.py:31:37: TC002 [*] Move third-party import `django.contrib.auth.models` into a type-checking block | 29 | from typing import literal 30 | 31 | from django.contrib.auth import models - | ^^^^^^ TCH002 + | ^^^^^^ TC002 32 | 33 | def test_attribute(arg: models.AbstractBaseUser["int"]): | @@ -121,12 +121,12 @@ quote3.py:31:37: TCH002 [*] Move third-party import `django.contrib.auth.models` 35 38 | 36 39 | -quote3.py:40:37: TCH002 [*] Move third-party import `django.contrib.auth.models` into a type-checking block +quote3.py:40:37: TC002 [*] Move third-party import `django.contrib.auth.models` into a type-checking block | 38 | from typing import Literal 39 | 40 | from django.contrib.auth import models - | ^^^^^^ TCH002 + | ^^^^^^ TC002 41 | 42 | def test_attribute_typing_literal(arg: models.AbstractBaseUser[Literal["admin"]]): | @@ -152,23 +152,23 @@ quote3.py:40:37: TCH002 [*] Move third-party import `django.contrib.auth.models` 44 47 | 45 48 | -quote3.py:59:29: TCH002 Move third-party import `third_party.Type` into a type-checking block +quote3.py:59:29: TC002 Move third-party import `third_party.Type` into a type-checking block | 57 | def f(): 58 | from typing import Literal 59 | from third_party import Type - | ^^^^ TCH002 + | ^^^^ TC002 60 | 61 | def test_string_contains_opposite_quote_do_not_fix(self, type1: Type[Literal["'"]], type2: Type[Literal["\'"]]): | = help: Move into type-checking block -quote3.py:67:29: TCH002 Move third-party import `third_party.Type` into a type-checking block +quote3.py:67:29: TC002 Move third-party import `third_party.Type` into a type-checking block | 65 | def f(): 66 | from typing import Literal 67 | from third_party import Type - | ^^^^ TCH002 + | ^^^^ TC002 68 | 69 | def test_quote_contains_backslash(self, type1: Type[Literal["\n"]], type2: Type[Literal["\""]]): | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_1.py.snap similarity index 70% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_1.py.snap index e3041bda97edc..9b4d1f4a7634c 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_1.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH004_1.py:4:26: TCH004 [*] Move import `datetime.datetime` out of type-checking block. Import is used for more than type hinting. +TC004_1.py:4:26: TC004 [*] Move import `datetime.datetime` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from datetime import datetime - | ^^^^^^^^ TCH004 + | ^^^^^^^^ TC004 5 | x = datetime | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_10.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_10.py.snap similarity index 100% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_10.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_10.py.snap diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_11.py.snap similarity index 71% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_11.py.snap index f37b5a0811313..74ba7d464e18e 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_11.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_11.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH004_11.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +TC004_11.py:4:24: TC004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List - | ^^^^ TCH004 + | ^^^^ TC004 5 | 6 | __all__ = ("List",) | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_12.py.snap similarity index 74% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_12.py.snap index c9c15c35a7555..9d22eb24bf73e 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_12.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_12.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH004_12.py:6:33: TCH004 [*] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting. +TC004_12.py:6:33: TC004 [*] Move import `collections.abc.Callable` out of type-checking block. Import is used for more than type hinting. | 5 | if TYPE_CHECKING: 6 | from collections.abc import Callable - | ^^^^^^^^ TCH004 + | ^^^^^^^^ TC004 7 | 8 | AnyCallable: TypeAlias = Callable[..., Any] | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_13.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_13.py.snap similarity index 100% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_13.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_13.py.snap diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_14.pyi.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_14.pyi.snap similarity index 100% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_14.pyi.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_14.pyi.snap diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_15.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_15.py.snap similarity index 100% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_15.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_15.py.snap diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_16.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_16.py.snap similarity index 100% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_16.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_16.py.snap diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_17.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_17.py.snap similarity index 73% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_17.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_17.py.snap index d31e06bd48010..1dd9c839b7d4d 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_17.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_17.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH004_17.py:6:24: TCH004 [*] Move import `pandas.DataFrame` out of type-checking block. Import is used for more than type hinting. +TC004_17.py:6:24: TC004 [*] Move import `pandas.DataFrame` out of type-checking block. Import is used for more than type hinting. | 5 | if TYPE_CHECKING: 6 | from pandas import DataFrame - | ^^^^^^^^^ TCH004 + | ^^^^^^^^^ TC004 | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_2.py.snap similarity index 70% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_2.py.snap index 5a8e67494780a..135189e40d776 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_2.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH004_2.py:4:26: TCH004 [*] Move import `datetime.date` out of type-checking block. Import is used for more than type hinting. +TC004_2.py:4:26: TC004 [*] Move import `datetime.date` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from datetime import date - | ^^^^ TCH004 + | ^^^^ TC004 | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_3.py.snap similarity index 100% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_3.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_3.py.snap diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_4.py.snap similarity index 72% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_4.py.snap index 99c8a1d035079..7dfef5f3eb92a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_4.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_4.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH004_4.py:4:24: TCH004 [*] Move import `typing.Any` out of type-checking block. Import is used for more than type hinting. +TC004_4.py:4:24: TC004 [*] Move import `typing.Any` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import Any - | ^^^ TCH004 + | ^^^ TC004 | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_5.py.snap similarity index 71% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_5.py.snap index 5459aac07dd03..39efab2ee5b3a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_5.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_5.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH004_5.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +TC004_5.py:4:24: TC004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set - | ^^^^ TCH004 + | ^^^^ TC004 | = help: Move out of type-checking block @@ -21,11 +21,11 @@ TCH004_5.py:4:24: TCH004 [*] Move import `typing.List` out of type-checking bloc 6 7 | 7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): -TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting. +TC004_5.py:4:30: TC004 [*] Move import `typing.Sequence` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set - | ^^^^^^^^ TCH004 + | ^^^^^^^^ TC004 | = help: Move out of type-checking block @@ -40,11 +40,11 @@ TCH004_5.py:4:30: TCH004 [*] Move import `typing.Sequence` out of type-checking 6 7 | 7 8 | def example(a: List[int], /, b: Sequence[int], *, c: Set[int]): -TCH004_5.py:4:40: TCH004 [*] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting. +TC004_5.py:4:40: TC004 [*] Move import `typing.Set` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import List, Sequence, Set - | ^^^ TCH004 + | ^^^ TC004 | = help: Move out of type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_6.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_6.py.snap similarity index 100% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_6.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_6.py.snap diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_7.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_7.py.snap similarity index 100% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_7.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_7.py.snap diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_8.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_8.py.snap similarity index 100% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_8.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_8.py.snap diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_9.py.snap similarity index 70% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_9.py.snap index 8ad6ada375c2f..765fd57c616c2 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_9.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_9.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH004_9.py:4:24: TCH004 [*] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting. +TC004_9.py:4:24: TC004 [*] Move import `typing.Tuple` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import Tuple, List, Dict - | ^^^^^ TCH004 + | ^^^^^ TC004 5 | 6 | x: Tuple | @@ -23,11 +23,11 @@ TCH004_9.py:4:24: TCH004 [*] Move import `typing.Tuple` out of type-checking blo 6 7 | x: Tuple 7 8 | -TCH004_9.py:4:31: TCH004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. +TC004_9.py:4:31: TC004 [*] Move import `typing.List` out of type-checking block. Import is used for more than type hinting. | 3 | if TYPE_CHECKING: 4 | from typing import Tuple, List, Dict - | ^^^^ TCH004 + | ^^^^ TC004 5 | 6 | x: Tuple | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap index 76a2daba73bf3..7d6b17588e505 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_quote.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -quote.py:57:28: TCH004 [*] Move import `pandas.DataFrame` out of type-checking block. Import is used for more than type hinting. +quote.py:57:28: TC004 [*] Move import `pandas.DataFrame` out of type-checking block. Import is used for more than type hinting. | 56 | if TYPE_CHECKING: 57 | from pandas import DataFrame - | ^^^^^^^^^ TCH004 + | ^^^^^^^^^ TC004 58 | 59 | def func(value: DataFrame): | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap index 280351a7328d7..689abb0884138 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_base_classes_1.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -runtime_evaluated_base_classes_1.py:10:12: TCH004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_base_classes_1.py:10:12: TC004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. | 9 | if TYPE_CHECKING: -10 | import datetime # TCH004 - | ^^^^^^^^ TCH004 -11 | from array import array # TCH004 +10 | import datetime # TC004 + | ^^^^^^^^ TC004 +11 | from array import array # TC004 | = help: Move out of type-checking block @@ -18,19 +18,19 @@ runtime_evaluated_base_classes_1.py:10:12: TCH004 [*] Move import `datetime` out 8 |+import datetime 8 9 | 9 10 | if TYPE_CHECKING: -10 |- import datetime # TCH004 -11 11 | from array import array # TCH004 +10 |- import datetime # TC004 +11 11 | from array import array # TC004 12 12 | -13 13 | import pandas # TCH004 +13 13 | import pandas # TC004 -runtime_evaluated_base_classes_1.py:11:23: TCH004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_base_classes_1.py:11:23: TC004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. | 9 | if TYPE_CHECKING: -10 | import datetime # TCH004 -11 | from array import array # TCH004 - | ^^^^^ TCH004 +10 | import datetime # TC004 +11 | from array import array # TC004 + | ^^^^^ TC004 12 | -13 | import pandas # TCH004 +13 | import pandas # TC004 | = help: Move out of type-checking block @@ -41,18 +41,18 @@ runtime_evaluated_base_classes_1.py:11:23: TCH004 [*] Move import `array.array` 8 |+from array import array 8 9 | 9 10 | if TYPE_CHECKING: -10 11 | import datetime # TCH004 -11 |- from array import array # TCH004 +10 11 | import datetime # TC004 +11 |- from array import array # TC004 12 12 | -13 13 | import pandas # TCH004 +13 13 | import pandas # TC004 14 14 | import pyproj -runtime_evaluated_base_classes_1.py:13:12: TCH004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_base_classes_1.py:13:12: TC004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. | -11 | from array import array # TCH004 +11 | from array import array # TC004 12 | -13 | import pandas # TCH004 - | ^^^^^^ TCH004 +13 | import pandas # TC004 + | ^^^^^^ TC004 14 | import pyproj | = help: Move out of type-checking block @@ -64,10 +64,10 @@ runtime_evaluated_base_classes_1.py:13:12: TCH004 [*] Move import `pandas` out o 8 |+import pandas 8 9 | 9 10 | if TYPE_CHECKING: -10 11 | import datetime # TCH004 -11 12 | from array import array # TCH004 +10 11 | import datetime # TC004 +11 12 | from array import array # TC004 12 13 | -13 |- import pandas # TCH004 +13 |- import pandas # TC004 14 14 | import pyproj 15 15 | 16 16 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap index b1ccd2fb6969f..e0a3725545a59 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_runtime_evaluated_decorators_1.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -runtime_evaluated_decorators_1.py:12:12: TCH004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_decorators_1.py:12:12: TC004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting. | 11 | if TYPE_CHECKING: -12 | import datetime # TCH004 - | ^^^^^^^^ TCH004 -13 | from array import array # TCH004 +12 | import datetime # TC004 + | ^^^^^^^^ TC004 +13 | from array import array # TC004 | = help: Move out of type-checking block @@ -18,19 +18,19 @@ runtime_evaluated_decorators_1.py:12:12: TCH004 [*] Move import `datetime` out o 10 |+import datetime 10 11 | 11 12 | if TYPE_CHECKING: -12 |- import datetime # TCH004 -13 13 | from array import array # TCH004 +12 |- import datetime # TC004 +13 13 | from array import array # TC004 14 14 | -15 15 | import pandas # TCH004 +15 15 | import pandas # TC004 -runtime_evaluated_decorators_1.py:13:23: TCH004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_decorators_1.py:13:23: TC004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting. | 11 | if TYPE_CHECKING: -12 | import datetime # TCH004 -13 | from array import array # TCH004 - | ^^^^^ TCH004 +12 | import datetime # TC004 +13 | from array import array # TC004 + | ^^^^^ TC004 14 | -15 | import pandas # TCH004 +15 | import pandas # TC004 | = help: Move out of type-checking block @@ -41,18 +41,18 @@ runtime_evaluated_decorators_1.py:13:23: TCH004 [*] Move import `array.array` ou 10 |+from array import array 10 11 | 11 12 | if TYPE_CHECKING: -12 13 | import datetime # TCH004 -13 |- from array import array # TCH004 +12 13 | import datetime # TC004 +13 |- from array import array # TC004 14 14 | -15 15 | import pandas # TCH004 +15 15 | import pandas # TC004 16 16 | import pyproj -runtime_evaluated_decorators_1.py:15:12: TCH004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. +runtime_evaluated_decorators_1.py:15:12: TC004 [*] Move import `pandas` out of type-checking block. Import is used for more than type hinting. | -13 | from array import array # TCH004 +13 | from array import array # TC004 14 | -15 | import pandas # TCH004 - | ^^^^^^ TCH004 +15 | import pandas # TC004 + | ^^^^^^ TC004 16 | import pyproj | = help: Move out of type-checking block @@ -64,10 +64,10 @@ runtime_evaluated_decorators_1.py:15:12: TCH004 [*] Move import `pandas` out of 10 |+import pandas 10 11 | 11 12 | if TYPE_CHECKING: -12 13 | import datetime # TCH004 -13 14 | from array import array # TCH004 +12 13 | import datetime # TC004 +13 14 | from array import array # TC004 14 15 | -15 |- import pandas # TCH004 +15 |- import pandas # TC004 16 16 | import pyproj 17 17 | 18 18 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_1.py.snap new file mode 100644 index 0000000000000..c4db736188e05 --- /dev/null +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_1.py.snap @@ -0,0 +1,11 @@ +--- +source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs +snapshot_kind: text +--- +TC010_1.py:18:30: TC010 Invalid string member in `X | Y`-style union type + | +16 | type A = Value["int" | str] # OK +17 | +18 | OldS = TypeVar('OldS', int | 'str', str) # TC010 + | ^^^^^ TC010 + | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_2.py.snap new file mode 100644 index 0000000000000..2dc80f40e266f --- /dev/null +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TC010_2.py.snap @@ -0,0 +1,40 @@ +--- +source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs +snapshot_kind: text +--- +TC010_2.py:4:4: TC010 Invalid string member in `X | Y`-style union type + | +4 | x: "int" | str # TC010 + | ^^^^^ TC010 +5 | x: ("int" | str) | "bool" # TC010 + | + +TC010_2.py:5:5: TC010 Invalid string member in `X | Y`-style union type + | +4 | x: "int" | str # TC010 +5 | x: ("int" | str) | "bool" # TC010 + | ^^^^^ TC010 + | + +TC010_2.py:5:20: TC010 Invalid string member in `X | Y`-style union type + | +4 | x: "int" | str # TC010 +5 | x: ("int" | str) | "bool" # TC010 + | ^^^^^^ TC010 + | + +TC010_2.py:12:20: TC010 Invalid string member in `X | Y`-style union type + | +12 | z: list[str, str | "int"] = [] # TC010 + | ^^^^^ TC010 +13 | +14 | type A = Value["int" | str] # OK + | + +TC010_2.py:16:30: TC010 Invalid string member in `X | Y`-style union type + | +14 | type A = Value["int" | str] # OK +15 | +16 | OldS = TypeVar('OldS', int | 'str', str) # TC010 + | ^^^^^ TC010 + | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_1.py.snap deleted file mode 100644 index f390b09be5380..0000000000000 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_1.py.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text ---- -TCH010_1.py:18:30: TCH010 Invalid string member in `X | Y`-style union type - | -16 | type A = Value["int" | str] # OK -17 | -18 | OldS = TypeVar('OldS', int | 'str', str) # TCH010 - | ^^^^^ TCH010 - | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_2.py.snap deleted file mode 100644 index ac29273ca4ed1..0000000000000 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-string-union_TCH010_2.py.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs -snapshot_kind: text ---- -TCH010_2.py:4:4: TCH010 Invalid string member in `X | Y`-style union type - | -4 | x: "int" | str # TCH010 - | ^^^^^ TCH010 -5 | x: ("int" | str) | "bool" # TCH010 - | - -TCH010_2.py:5:5: TCH010 Invalid string member in `X | Y`-style union type - | -4 | x: "int" | str # TCH010 -5 | x: ("int" | str) | "bool" # TCH010 - | ^^^^^ TCH010 - | - -TCH010_2.py:5:20: TCH010 Invalid string member in `X | Y`-style union type - | -4 | x: "int" | str # TCH010 -5 | x: ("int" | str) | "bool" # TCH010 - | ^^^^^^ TCH010 - | - -TCH010_2.py:12:20: TCH010 Invalid string member in `X | Y`-style union type - | -12 | z: list[str, str | "int"] = [] # TCH010 - | ^^^^^ TCH010 -13 | -14 | type A = Value["int" | str] # OK - | - -TCH010_2.py:16:30: TCH010 Invalid string member in `X | Y`-style union type - | -14 | type A = Value["int" | str] # OK -15 | -16 | OldS = TypeVar('OldS', int | 'str', str) # TCH010 - | ^^^^^ TCH010 - | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap index ccf07d1231b57..35e5ef0a4e506 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_init_var.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -init_var.py:5:25: TCH003 [*] Move standard library import `dataclasses.FrozenInstanceError` into a type-checking block +init_var.py:5:25: TC003 [*] Move standard library import `dataclasses.FrozenInstanceError` into a type-checking block | 3 | from __future__ import annotations 4 | 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass - | ^^^^^^^^^^^^^^^^^^^ TCH003 + | ^^^^^^^^^^^^^^^^^^^ TC003 6 | from pathlib import Path | = help: Move into type-checking block @@ -27,11 +27,11 @@ init_var.py:5:25: TCH003 [*] Move standard library import `dataclasses.FrozenIns 8 12 | 9 13 | @dataclass -init_var.py:6:21: TCH003 [*] Move standard library import `pathlib.Path` into a type-checking block +init_var.py:6:21: TC003 [*] Move standard library import `pathlib.Path` into a type-checking block | 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass 6 | from pathlib import Path - | ^^^^ TCH003 + | ^^^^ TC003 | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap index 16093cb706a16..08742fa65e8e7 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-standard-library-import_kw_only.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -kw_only.py:5:45: TCH003 [*] Move standard library import `dataclasses.Field` into a type-checking block +kw_only.py:5:45: TC003 [*] Move standard library import `dataclasses.Field` into a type-checking block | 3 | from __future__ import annotations 4 | 5 | from dataclasses import KW_ONLY, dataclass, Field - | ^^^^^ TCH003 + | ^^^^^ TC003 | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap index d7749bfb9d19d..ca5ceb2983776 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__strict_typing-only-third-party-import_strict.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -strict.py:27:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking block +strict.py:27:21: TC002 [*] Move third-party import `pkg.A` into a type-checking block | 25 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. 26 | import pkg 27 | from pkg import A - | ^ TCH002 + | ^ TC002 28 | 29 | def test(value: A): | @@ -31,12 +31,12 @@ strict.py:27:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking 29 32 | def test(value: A): 30 33 | return pkg.B() -strict.py:35:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking block +strict.py:35:21: TC002 [*] Move third-party import `pkg.A` into a type-checking block | 33 | def f(): 34 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. 35 | from pkg import A, B - | ^ TCH002 + | ^ TC002 36 | 37 | def test(value: A): | @@ -61,12 +61,12 @@ strict.py:35:21: TCH002 [*] Move third-party import `pkg.A` into a type-checking 37 41 | def test(value: A): 38 42 | return B() -strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-checking block +strict.py:54:25: TC002 [*] Move third-party import `pkg.bar.A` into a type-checking block | 52 | # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime 53 | import pkg 54 | from pkg.bar import A - | ^ TCH002 + | ^ TC002 55 | 56 | def test(value: A): | @@ -90,12 +90,12 @@ strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-chec 56 59 | def test(value: A): 57 60 | return pkg.B() -strict.py:62:12: TCH002 [*] Move third-party import `pkg` into a type-checking block +strict.py:62:12: TC002 [*] Move third-party import `pkg` into a type-checking block | 60 | def f(): 61 | # In un-strict mode, this shouldn't raise an error, since `pkg.bar` is used at runtime. 62 | import pkg - | ^^^ TCH002 + | ^^^ TC002 63 | import pkg.bar as B | = help: Move into type-checking block @@ -118,12 +118,12 @@ strict.py:62:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 64 67 | 65 68 | def test(value: pkg.A): -strict.py:71:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checking block +strict.py:71:23: TC002 [*] Move third-party import `pkg.foo` into a type-checking block | 69 | def f(): 70 | # In un-strict mode, this shouldn't raise an error, since `pkg.foo.bar` is used at runtime. 71 | import pkg.foo as F - | ^ TCH002 + | ^ TC002 72 | import pkg.foo.bar as B | = help: Move into type-checking block @@ -146,12 +146,12 @@ strict.py:71:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checki 73 76 | 74 77 | def test(value: F.Foo): -strict.py:80:12: TCH002 [*] Move third-party import `pkg` into a type-checking block +strict.py:80:12: TC002 [*] Move third-party import `pkg` into a type-checking block | 78 | def f(): 79 | # In un-strict mode, this shouldn't raise an error, since `pkg.foo.bar` is used at runtime. 80 | import pkg - | ^^^ TCH002 + | ^^^ TC002 81 | import pkg.foo.bar as B | = help: Move into type-checking block @@ -174,12 +174,12 @@ strict.py:80:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 82 85 | 83 86 | def test(value: pkg.A): -strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking block +strict.py:91:12: TC002 [*] Move third-party import `pkg` into a type-checking block | 89 | # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is 90 | # testing the implementation. 91 | import pkg - | ^^^ TCH002 + | ^^^ TC002 92 | import pkgfoo.bar as B | = help: Move into type-checking block @@ -202,12 +202,12 @@ strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking b 93 96 | 94 97 | def test(value: pkg.A): -strict.py:101:23: TCH002 [*] Move third-party import `pkg.foo` into a type-checking block +strict.py:101:23: TC002 [*] Move third-party import `pkg.foo` into a type-checking block | 99 | # In un-strict mode, this shouldn't raise an error, since `pkg` is used at runtime. 100 | import pkg.bar as B 101 | import pkg.foo as F - | ^ TCH002 + | ^ TC002 102 | 103 | def test(value: F.Foo): | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap index f30a9d6393b5a..23e2c0e0ff3bd 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_after_usage.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | 6 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 7 | 8 | def f(x: pd.DataFrame): | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap index f227c90187e07..06cc0d470017c 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_comment.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | 6 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 7 | 8 | if TYPE_CHECKING: | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap index 968cf83961791..946226bbecd79 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_inline.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | 6 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 7 | 8 | if TYPE_CHECKING: import os | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap index fbc9fffac1aaf..ecb1a3e892e42 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__type_checking_block_own_line.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | 6 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 7 | 8 | if TYPE_CHECKING: | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TC001.py.snap similarity index 75% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TC001.py.snap index 280c98d1a17d2..3ea3a853b8f0e 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TCH001.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-first-party-import_TC001.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH001.py:20:19: TCH001 [*] Move application import `.TYP001` into a type-checking block +TC001.py:20:19: TC001 [*] Move application import `.TYP001` into a type-checking block | 19 | def f(): 20 | from . import TYP001 - | ^^^^^^ TCH001 + | ^^^^^^ TC001 21 | 22 | x: TYP001 | @@ -14,7 +14,7 @@ TCH001.py:20:19: TCH001 [*] Move application import `.TYP001` into a type-checki ℹ Unsafe fix 2 2 | -3 3 | For typing-only import detection tests, see `TCH002.py`. +3 3 | For typing-only import detection tests, see `TC002.py`. 4 4 | """ 5 |+from typing import TYPE_CHECKING 6 |+ diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TC003.py.snap similarity index 70% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TC003.py.snap index 54a19f12cbede..d527f4ccb1820 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TCH003.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_TC003.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH003.py:8:12: TCH003 [*] Move standard library import `os` into a type-checking block +TC003.py:8:12: TC003 [*] Move standard library import `os` into a type-checking block | 7 | def f(): 8 | import os - | ^^ TCH003 + | ^^ TC003 9 | 10 | x: os | @@ -14,7 +14,7 @@ TCH003.py:8:12: TCH003 [*] Move standard library import `os` into a type-checkin ℹ Unsafe fix 2 2 | -3 3 | For typing-only import detection tests, see `TCH002.py`. +3 3 | For typing-only import detection tests, see `TC002.py`. 4 4 | """ 5 |+from typing import TYPE_CHECKING 6 |+ diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap index a258a658c93e2..0e97a464641fb 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_1.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -exempt_type_checking_1.py:5:20: TCH003 [*] Move standard library import `typing.Final` into a type-checking block +exempt_type_checking_1.py:5:20: TC003 [*] Move standard library import `typing.Final` into a type-checking block | 3 | from __future__ import annotations 4 | 5 | from typing import Final - | ^^^^^ TCH003 + | ^^^^^ TC003 6 | 7 | Const: Final[dict] = {} | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap index 2fd90e9329c45..32cf29f776503 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_2.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -exempt_type_checking_2.py:5:20: TCH003 [*] Move standard library import `typing.Final` into a type-checking block +exempt_type_checking_2.py:5:20: TC003 [*] Move standard library import `typing.Final` into a type-checking block | 3 | from __future__ import annotations 4 | 5 | from typing import Final, TYPE_CHECKING - | ^^^^^ TCH003 + | ^^^^^ TC003 6 | 7 | Const: Final[dict] = {} | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap index 1771dca763d7b..c93a7aba9ac26 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_exempt_type_checking_3.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -exempt_type_checking_3.py:5:20: TCH003 [*] Move standard library import `typing.Final` into a type-checking block +exempt_type_checking_3.py:5:20: TC003 [*] Move standard library import `typing.Final` into a type-checking block | 3 | from __future__ import annotations 4 | 5 | from typing import Final, Mapping - | ^^^^^ TCH003 + | ^^^^^ TC003 6 | 7 | Const: Final[dict] = {} | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_init_var.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_init_var.py.snap index 43013e15c1eb8..11a40633dd6b1 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_init_var.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_init_var.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -init_var.py:6:21: TCH003 [*] Move standard library import `pathlib.Path` into a type-checking block +init_var.py:6:21: TC003 [*] Move standard library import `pathlib.Path` into a type-checking block | 5 | from dataclasses import FrozenInstanceError, InitVar, dataclass 6 | from pathlib import Path - | ^^^^ TCH003 + | ^^^^ TC003 | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap index e5f2701c5d189..490c756534e3b 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_module__undefined.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -undefined.py:3:29: TCH003 [*] Move standard library import `collections.abc.Sequence` into a type-checking block +undefined.py:3:29: TC003 [*] Move standard library import `collections.abc.Sequence` into a type-checking block | 1 | from __future__ import annotations 2 | 3 | from collections.abc import Sequence - | ^^^^^^^^ TCH003 + | ^^^^^^^^ TC003 | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap index 5face1e3254a5..95cf17c1626af 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_base_classes_3.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -runtime_evaluated_base_classes_3.py:5:18: TCH003 [*] Move standard library import `uuid.UUID` into a type-checking block +runtime_evaluated_base_classes_3.py:5:18: TC003 [*] Move standard library import `uuid.UUID` into a type-checking block | 3 | import datetime 4 | import pathlib -5 | from uuid import UUID # TCH003 - | ^^^^ TCH003 +5 | from uuid import UUID # TC003 + | ^^^^ TC003 6 | 7 | import pydantic | @@ -17,7 +17,7 @@ runtime_evaluated_base_classes_3.py:5:18: TCH003 [*] Move standard library impor 2 2 | 3 3 | import datetime 4 4 | import pathlib -5 |-from uuid import UUID # TCH003 +5 |-from uuid import UUID # TC003 6 5 | 7 6 | import pydantic 8 7 | from pydantic import BaseModel diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap index 69d3595d33a48..bba4e32fee5ec 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_runtime_evaluated_decorators_3.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -runtime_evaluated_decorators_3.py:6:18: TCH003 [*] Move standard library import `uuid.UUID` into a type-checking block +runtime_evaluated_decorators_3.py:6:18: TC003 [*] Move standard library import `uuid.UUID` into a type-checking block | 4 | from array import array 5 | from dataclasses import dataclass -6 | from uuid import UUID # TCH003 - | ^^^^ TCH003 +6 | from uuid import UUID # TC003 + | ^^^^ TC003 7 | from collections.abc import Sequence 8 | from pydantic import validate_call | @@ -17,7 +17,7 @@ runtime_evaluated_decorators_3.py:6:18: TCH003 [*] Move standard library import 3 3 | import datetime 4 4 | from array import array 5 5 | from dataclasses import dataclass -6 |-from uuid import UUID # TCH003 +6 |-from uuid import UUID # TC003 7 6 | from collections.abc import Sequence 8 7 | from pydantic import validate_call 9 8 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_singledispatchmethod.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_singledispatchmethod.py.snap index 19e26960deaa0..18e5d97933524 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_singledispatchmethod.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-standard-library-import_singledispatchmethod.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -singledispatchmethod.py:4:21: TCH003 [*] Move standard library import `pathlib.Path` into a type-checking block +singledispatchmethod.py:4:21: TC003 [*] Move standard library import `pathlib.Path` into a type-checking block | 3 | from collections.abc import MutableMapping, Mapping 4 | from pathlib import Path - | ^^^^ TCH003 + | ^^^^ TC003 5 | from functools import singledispatchmethod 6 | from typing import Union | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TC002.py.snap similarity index 70% rename from crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap rename to crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TC002.py.snap index 57fea806f5ff1..3c59bc98ee82e 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TCH002.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_TC002.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -TCH002.py:5:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +TC002.py:5:22: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | def f(): -5 | import pandas as pd # TCH002 - | ^^ TCH002 +5 | import pandas as pd # TC002 + | ^^ TC002 6 | 7 | x: pd.DataFrame | @@ -21,16 +21,16 @@ TCH002.py:5:22: TCH002 [*] Move third-party import `pandas` into a type-checking 2 6 | 3 7 | 4 8 | def f(): -5 |- import pandas as pd # TCH002 +5 |- import pandas as pd # TC002 6 9 | 7 10 | x: pd.DataFrame 8 11 | -TCH002.py:11:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +TC002.py:11:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 10 | def f(): -11 | from pandas import DataFrame # TCH002 - | ^^^^^^^^^ TCH002 +11 | from pandas import DataFrame # TC002 + | ^^^^^^^^^ TC002 12 | 13 | x: DataFrame | @@ -49,16 +49,16 @@ TCH002.py:11:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 8 12 | 9 13 | 10 14 | def f(): -11 |- from pandas import DataFrame # TCH002 +11 |- from pandas import DataFrame # TC002 12 15 | 13 16 | x: DataFrame 14 17 | -TCH002.py:17:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +TC002.py:17:37: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 16 | def f(): -17 | from pandas import DataFrame as df # TCH002 - | ^^ TCH002 +17 | from pandas import DataFrame as df # TC002 + | ^^ TC002 18 | 19 | x: df | @@ -77,16 +77,16 @@ TCH002.py:17:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 14 18 | 15 19 | 16 20 | def f(): -17 |- from pandas import DataFrame as df # TCH002 +17 |- from pandas import DataFrame as df # TC002 18 21 | 19 22 | x: df 20 23 | -TCH002.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +TC002.py:23:22: TC002 [*] Move third-party import `pandas` into a type-checking block | 22 | def f(): -23 | import pandas as pd # TCH002 - | ^^ TCH002 +23 | import pandas as pd # TC002 + | ^^ TC002 24 | 25 | x: pd.DataFrame = 1 | @@ -105,16 +105,16 @@ TCH002.py:23:22: TCH002 [*] Move third-party import `pandas` into a type-checkin 20 24 | 21 25 | 22 26 | def f(): -23 |- import pandas as pd # TCH002 +23 |- import pandas as pd # TC002 24 27 | 25 28 | x: pd.DataFrame = 1 26 29 | -TCH002.py:29:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +TC002.py:29:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 28 | def f(): -29 | from pandas import DataFrame # TCH002 - | ^^^^^^^^^ TCH002 +29 | from pandas import DataFrame # TC002 + | ^^^^^^^^^ TC002 30 | 31 | x: DataFrame = 2 | @@ -133,16 +133,16 @@ TCH002.py:29:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 26 30 | 27 31 | 28 32 | def f(): -29 |- from pandas import DataFrame # TCH002 +29 |- from pandas import DataFrame # TC002 30 33 | 31 34 | x: DataFrame = 2 32 35 | -TCH002.py:35:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +TC002.py:35:37: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 34 | def f(): -35 | from pandas import DataFrame as df # TCH002 - | ^^ TCH002 +35 | from pandas import DataFrame as df # TC002 + | ^^ TC002 36 | 37 | x: df = 3 | @@ -161,16 +161,16 @@ TCH002.py:35:37: TCH002 [*] Move third-party import `pandas.DataFrame` into a ty 32 36 | 33 37 | 34 38 | def f(): -35 |- from pandas import DataFrame as df # TCH002 +35 |- from pandas import DataFrame as df # TC002 36 39 | 37 40 | x: df = 3 38 41 | -TCH002.py:41:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +TC002.py:41:22: TC002 [*] Move third-party import `pandas` into a type-checking block | 40 | def f(): -41 | import pandas as pd # TCH002 - | ^^ TCH002 +41 | import pandas as pd # TC002 + | ^^ TC002 42 | 43 | x: "pd.DataFrame" = 1 | @@ -189,16 +189,16 @@ TCH002.py:41:22: TCH002 [*] Move third-party import `pandas` into a type-checkin 38 42 | 39 43 | 40 44 | def f(): -41 |- import pandas as pd # TCH002 +41 |- import pandas as pd # TC002 42 45 | 43 46 | x: "pd.DataFrame" = 1 44 47 | -TCH002.py:47:22: TCH002 [*] Move third-party import `pandas` into a type-checking block +TC002.py:47:22: TC002 [*] Move third-party import `pandas` into a type-checking block | 46 | def f(): -47 | import pandas as pd # TCH002 - | ^^ TCH002 +47 | import pandas as pd # TC002 + | ^^ TC002 48 | 49 | x = dict["pd.DataFrame", "pd.DataFrame"] | @@ -217,17 +217,17 @@ TCH002.py:47:22: TCH002 [*] Move third-party import `pandas` into a type-checkin 44 48 | 45 49 | 46 50 | def f(): -47 |- import pandas as pd # TCH002 +47 |- import pandas as pd # TC002 48 51 | 49 52 | x = dict["pd.DataFrame", "pd.DataFrame"] 50 53 | -TCH002.py:172:24: TCH002 [*] Move third-party import `module.Member` into a type-checking block +TC002.py:172:24: TC002 [*] Move third-party import `module.Member` into a type-checking block | 170 | global Member 171 | 172 | from module import Member - | ^^^^^^ TCH002 + | ^^^^^^ TC002 173 | 174 | x: Member = 1 | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap index 1574384e8f85c..f8634941ee460 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_base_classes_2.py.snap @@ -2,23 +2,23 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -runtime_evaluated_base_classes_2.py:3:21: TCH002 [*] Move third-party import `geopandas` into a type-checking block +runtime_evaluated_base_classes_2.py:3:21: TC002 [*] Move third-party import `geopandas` into a type-checking block | 1 | from __future__ import annotations 2 | -3 | import geopandas as gpd # TCH002 - | ^^^ TCH002 +3 | import geopandas as gpd # TC002 + | ^^^ TC002 4 | import pydantic -5 | import pyproj # TCH002 +5 | import pyproj # TC002 | = help: Move into type-checking block ℹ Unsafe fix 1 1 | from __future__ import annotations 2 2 | -3 |-import geopandas as gpd # TCH002 +3 |-import geopandas as gpd # TC002 4 3 | import pydantic -5 4 | import pyproj # TCH002 +5 4 | import pyproj # TC002 6 5 | from pydantic import BaseModel 7 6 | 8 7 | import numpy @@ -30,21 +30,21 @@ runtime_evaluated_base_classes_2.py:3:21: TCH002 [*] Move third-party import `ge 10 13 | 11 14 | class A(BaseModel): -runtime_evaluated_base_classes_2.py:5:8: TCH002 [*] Move third-party import `pyproj` into a type-checking block +runtime_evaluated_base_classes_2.py:5:8: TC002 [*] Move third-party import `pyproj` into a type-checking block | -3 | import geopandas as gpd # TCH002 +3 | import geopandas as gpd # TC002 4 | import pydantic -5 | import pyproj # TCH002 - | ^^^^^^ TCH002 +5 | import pyproj # TC002 + | ^^^^^^ TC002 6 | from pydantic import BaseModel | = help: Move into type-checking block ℹ Unsafe fix 2 2 | -3 3 | import geopandas as gpd # TCH002 +3 3 | import geopandas as gpd # TC002 4 4 | import pydantic -5 |-import pyproj # TCH002 +5 |-import pyproj # TC002 6 5 | from pydantic import BaseModel 7 6 | 8 7 | import numpy diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap index 10698e8545244..b78f6b46733d2 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_runtime_evaluated_decorators_2.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -runtime_evaluated_decorators_2.py:10:8: TCH002 [*] Move third-party import `numpy` into a type-checking block +runtime_evaluated_decorators_2.py:10:8: TC002 [*] Move third-party import `numpy` into a type-checking block | 8 | from attrs import frozen 9 | -10 | import numpy # TCH002 - | ^^^^^ TCH002 +10 | import numpy # TC002 + | ^^^^^ TC002 | = help: Move into type-checking block @@ -15,7 +15,7 @@ runtime_evaluated_decorators_2.py:10:8: TCH002 [*] Move third-party import `nump 7 7 | import pyproj 8 8 | from attrs import frozen 9 9 | -10 |-import numpy # TCH002 +10 |-import numpy # TC002 10 |+from typing import TYPE_CHECKING 11 |+ 12 |+if TYPE_CHECKING: diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap index 70028e22f7dae..157d972cd356a 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -singledispatch.py:12:20: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +singledispatch.py:12:20: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 10 | from numpy.typing import ArrayLike 11 | from scipy.sparse import spmatrix 12 | from pandas import DataFrame - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 13 | 14 | if TYPE_CHECKING: | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap index a646e661fde9f..d1cd9de5996d4 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_strict.py.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-checking block +strict.py:54:25: TC002 [*] Move third-party import `pkg.bar.A` into a type-checking block | 52 | # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime 53 | import pkg 54 | from pkg.bar import A - | ^ TCH002 + | ^ TC002 55 | 56 | def test(value: A): | @@ -31,12 +31,12 @@ strict.py:54:25: TCH002 [*] Move third-party import `pkg.bar.A` into a type-chec 56 59 | def test(value: A): 57 60 | return pkg.B() -strict.py:91:12: TCH002 [*] Move third-party import `pkg` into a type-checking block +strict.py:91:12: TC002 [*] Move third-party import `pkg` into a type-checking block | 89 | # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is 90 | # testing the implementation. 91 | import pkg - | ^^^ TCH002 + | ^^^ TC002 92 | import pkgfoo.bar as B | = help: Move into type-checking block diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap index 8e5d5a34d960e..76f2c216a29ae 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_1.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -typing_modules_1.py:7:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +typing_modules_1.py:7:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 6 | def func(): 7 | from pandas import DataFrame - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 8 | 9 | df: DataFrame | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap index 4f8902f141c6b..c9f5129aa83ab 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing-only-third-party-import_typing_modules_2.py.snap @@ -2,11 +2,11 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -typing_modules_2.py:7:24: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block +typing_modules_2.py:7:24: TC002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | 6 | def func(): 7 | from pandas import DataFrame - | ^^^^^^^^^ TCH002 + | ^^^^^^^^^ TC002 8 | 9 | df: DataFrame | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap index 09fac85b0c916..1179b87df9bae 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_package_import.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:4:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:4:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 2 | from __future__ import annotations 3 | 4 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 5 | 6 | from typing import TYPE_CHECKING | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap index 9cbe4402f732f..38771b04fb5f0 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_after_usage.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:4:18: TCH002 Move third-party import `pandas` into a type-checking block +:4:18: TC002 Move third-party import `pandas` into a type-checking block | 2 | from __future__ import annotations 3 | 4 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 5 | 6 | def f(x: pd.DataFrame): | diff --git a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap index 21044eb1bda07..c080a0659ee44 100644 --- a/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap +++ b/crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__typing_import_before_package_import.snap @@ -2,12 +2,12 @@ source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs snapshot_kind: text --- -:6:18: TCH002 [*] Move third-party import `pandas` into a type-checking block +:6:18: TC002 [*] Move third-party import `pandas` into a type-checking block | 4 | from typing import TYPE_CHECKING 5 | 6 | import pandas as pd - | ^^ TCH002 + | ^^ TC002 7 | 8 | def f(x: pd.DataFrame): | diff --git a/ruff.schema.json b/ruff.schema.json index 843a1d615832f..71efd1dc350fb 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -4000,16 +4000,16 @@ "T20", "T201", "T203", - "TCH", - "TCH0", - "TCH00", - "TCH001", - "TCH002", - "TCH003", - "TCH004", - "TCH005", - "TCH01", - "TCH010", + "TC", + "TC0", + "TC00", + "TC001", + "TC002", + "TC003", + "TC004", + "TC005", + "TC01", + "TC010", "TD", "TD0", "TD00",